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

empty_state_spec.js « test_reports « pipelines « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ee0f8a90a118c28f33bd13765560a3febc5830c5 (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
43
44
45
import { GlEmptyState } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import EmptyState, { i18n } from '~/pipelines/components/test_reports/empty_state.vue';

describe('Test report empty state', () => {
  let wrapper;

  const findEmptyState = () => wrapper.findComponent(GlEmptyState);

  const createComponent = ({ hasTestReport = true } = {}) => {
    wrapper = shallowMount(EmptyState, {
      provide: {
        emptyStateImagePath: '/image/path',
        hasTestReport,
      },
      stubs: {
        GlEmptyState,
      },
    });
  };

  describe('when pipeline has a test report', () => {
    it('should render empty test report message', () => {
      createComponent();

      expect(findEmptyState().props()).toMatchObject({
        primaryButtonText: i18n.noTestsButton,
        description: i18n.noTestsDescription,
        title: i18n.noTestsTitle,
      });
    });
  });

  describe('when pipeline does not have a test report', () => {
    it('should render no test report message', () => {
      createComponent({ hasTestReport: false });

      expect(findEmptyState().props()).toMatchObject({
        primaryButtonText: i18n.noReportsButton,
        description: i18n.noReportsDescription,
        title: i18n.noReportsTitle,
      });
    });
  });
});