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

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).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).exists()).toBe(true);
    });
  });
});