Welcome to mirror list, hosted at ThFree Co, Russian Federation.

deployment_status_badge_spec.js « environments « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 02aae57396ab7c42478638c57076eb9b03e4cf60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { GlBadge } from '@gitlab/ui';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import { s__ } from '~/locale';
import DeploymentStatusBadge from '~/environments/components/deployment_status_badge.vue';

describe('~/environments/components/deployment_status_badge.vue', () => {
  let wrapper;

  const createWrapper = ({ propsData = {} } = {}) =>
    mountExtended(DeploymentStatusBadge, {
      propsData,
    });

  describe.each`
    status        | text                           | variant      | icon
    ${'created'}  | ${s__('Deployment|Created')}   | ${'neutral'} | ${'status_created'}
    ${'running'}  | ${s__('Deployment|Running')}   | ${'info'}    | ${'status_running'}
    ${'success'}  | ${s__('Deployment|Success')}   | ${'success'} | ${'status_success'}
    ${'failed'}   | ${s__('Deployment|Failed')}    | ${'danger'}  | ${'status_failed'}
    ${'canceled'} | ${s__('Deployment|Cancelled')} | ${'neutral'} | ${'status_canceled'}
    ${'skipped'}  | ${s__('Deployment|Skipped')}   | ${'neutral'} | ${'status_skipped'}
    ${'blocked'}  | ${s__('Deployment|Waiting')}   | ${'neutral'} | ${'status_manual'}
  `('$status', ({ status, text, variant, icon }) => {
    let badge;

    beforeEach(() => {
      wrapper = createWrapper({ propsData: { status } });
      badge = wrapper.findComponent(GlBadge);
    });

    it(`sets the text to ${text}`, () => {
      expect(wrapper.text()).toBe(text);
    });

    it(`sets the variant to ${variant}`, () => {
      expect(badge.props('variant')).toBe(variant);
    });
    it(`sets the icon to ${icon}`, () => {
      expect(badge.props('icon')).toBe(icon);
    });
  });
});