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

formatted_stage_count_spec.js « cycle_analytics « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1228b8511ea0fecd64a92414efb51f42f0be45d6 (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
import { shallowMount } from '@vue/test-utils';
import Component from '~/cycle_analytics/components/formatted_stage_count.vue';

describe('Formatted Stage Count', () => {
  let wrapper = null;

  const createComponent = (stageCount = null) => {
    wrapper = shallowMount(Component, {
      propsData: {
        stageCount,
      },
    });
  };

  beforeEach(() => {
    createComponent();
  });

  afterEach(() => {
    wrapper.destroy();
  });

  it.each`
    stageCount | expectedOutput
    ${null}    | ${'-'}
    ${1}       | ${'1 item'}
    ${10}      | ${'10 items'}
    ${1000}    | ${'1,000 items'}
    ${1001}    | ${'1,000+ items'}
  `('returns "$expectedOutput" for stageCount=$stageCount', ({ stageCount, expectedOutput }) => {
    createComponent(stageCount);
    expect(wrapper.text()).toContain(expectedOutput);
  });
});