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

alert_management_system_note_spec.js « system_notes « components « alert_management « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8dd663e55d9fd11c09d75f09c9277e6b3d821709 (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
import { shallowMount } from '@vue/test-utils';
import SystemNote from '~/alert_management/components/system_notes/system_note.vue';
import mockAlerts from '../../mocks/alerts.json';

const mockAlert = mockAlerts[1];

describe('Alert Details System Note', () => {
  let wrapper;

  function mountComponent({ stubs = {} } = {}) {
    wrapper = shallowMount(SystemNote, {
      propsData: {
        note: { ...mockAlert.notes.nodes[0] },
      },
      stubs,
    });
  }

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

  describe('System notes', () => {
    beforeEach(() => {
      mountComponent({});
    });

    it('renders the correct system note', () => {
      const noteId = wrapper.find('.note-wrapper').attributes('id');
      const iconRoute = wrapper.find('use').attributes('href');

      expect(noteId).toBe('note_1628');
      expect(iconRoute.includes('user')).toBe(true);
    });
  });
});