summaryrefslogtreecommitdiff
path: root/spec/frontend/alert_management/components/alert_summary_row_spec.js
blob: 47c715c089a0be3c01435f30b22b434752fef3c8 (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
import { shallowMount } from '@vue/test-utils';
import AlertSummaryRow from '~/alert_management/components/alert_summary_row.vue';

const label = 'a label';
const value = 'a value';

describe('AlertSummaryRow', () => {
  let wrapper;

  function mountComponent({ mountMethod = shallowMount, props, defaultSlot } = {}) {
    wrapper = mountMethod(AlertSummaryRow, {
      propsData: props,
      scopedSlots: {
        default: defaultSlot,
      },
    });
  }

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

  describe('Alert Summary Row', () => {
    beforeEach(() => {
      mountComponent({
        props: {
          label,
        },
        defaultSlot: `<span class="value">${value}</span>`,
      });
    });

    it('should display a label and a value', () => {
      expect(wrapper.text()).toBe(`${label} ${value}`);
    });
  });
});