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

security_summary_spec.js « security_reports « components « vue_shared « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 61cdc3292205fac533f057b764b0af2155641569 (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 { GlSprintf } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import SecuritySummary from '~/vue_shared/security_reports/components/security_summary.vue';
import { groupedTextBuilder } from '~/vue_shared/security_reports/store/utils';

describe('SecuritySummary component', () => {
  let wrapper;

  const createWrapper = (message) => {
    wrapper = shallowMount(SecuritySummary, {
      propsData: { message },
      stubs: {
        GlSprintf,
      },
    });
  };

  describe.each([
    { message: '' },
    { message: 'foo' },
    groupedTextBuilder({ reportType: 'Security scanning', critical: 1, high: 0, total: 1 }),
    groupedTextBuilder({ reportType: 'Security scanning', critical: 0, high: 1, total: 1 }),
    groupedTextBuilder({ reportType: 'Security scanning', critical: 1, high: 2, total: 3 }),
  ])('given the message %p', (message) => {
    beforeEach(() => {
      createWrapper(message);
    });

    it('interpolates correctly', () => {
      expect(wrapper.element).toMatchSnapshot();
    });
  });
});