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

jobs_table_tabs_spec.js « table « components « jobs « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ac9b45be932d929937f2378e649eda62b855e1d1 (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 { mount } from '@vue/test-utils';
import { trimText } from 'helpers/text_helper';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import JobsTableTabs from '~/jobs/components/table/jobs_table_tabs.vue';

describe('Jobs Table Tabs', () => {
  let wrapper;

  const defaultProps = {
    jobCounts: { all: 848, pending: 0, running: 0, finished: 704 },
  };

  const findTab = (testId) => wrapper.findByTestId(testId);

  const createComponent = () => {
    wrapper = extendedWrapper(
      mount(JobsTableTabs, {
        provide: {
          ...defaultProps,
        },
      }),
    );
  };

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

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

  it.each`
    tabId                  | text          | count
    ${'jobs-all-tab'}      | ${'All'}      | ${defaultProps.jobCounts.all}
    ${'jobs-pending-tab'}  | ${'Pending'}  | ${defaultProps.jobCounts.pending}
    ${'jobs-running-tab'}  | ${'Running'}  | ${defaultProps.jobCounts.running}
    ${'jobs-finished-tab'} | ${'Finished'} | ${defaultProps.jobCounts.finished}
  `('displays the right tab text and badge count', ({ tabId, text, count }) => {
    expect(trimText(findTab(tabId).text())).toBe(`${text} ${count}`);
  });
});