summaryrefslogtreecommitdiff
path: root/spec/frontend/reports/components/report_item_spec.js
blob: bacbb3995138303a81d38833e06111637d858309 (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
import { shallowMount } from '@vue/test-utils';
import { STATUS_SUCCESS } from '~/reports/constants';
import ReportItem from '~/reports/components/report_item.vue';
import { componentNames } from '~/reports/components/issue_body';

describe('ReportItem', () => {
  describe('showReportSectionStatusIcon', () => {
    it('does not render CI Status Icon when showReportSectionStatusIcon is false', () => {
      const wrapper = shallowMount(ReportItem, {
        propsData: {
          issue: { foo: 'bar' },
          component: componentNames.TestIssueBody,
          status: STATUS_SUCCESS,
          showReportSectionStatusIcon: false,
        },
      });

      expect(wrapper.find('issuestatusicon-stub').exists()).toBe(false);
    });

    it('shows status icon when unspecified', () => {
      const wrapper = shallowMount(ReportItem, {
        propsData: {
          issue: { foo: 'bar' },
          component: componentNames.TestIssueBody,
          status: STATUS_SUCCESS,
        },
      });

      expect(wrapper.find('issuestatusicon-stub').exists()).toBe(true);
    });
  });
});