blob: d230b96ad82a5d164ed274c33fc79a88d7fae609 (
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
41
42
43
44
45
|
import { GlAlert, GlSprintf } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import ClustersDeprecationAlert from '~/projects/clusters_deprecation_alert/components/clusters_deprecation_alert.vue';
const message = 'Alert message';
describe('ClustersDeprecationAlert', () => {
let wrapper;
const provideData = {
message,
};
const findAlert = () => wrapper.findComponent(GlAlert);
const createComponent = () => {
wrapper = shallowMount(ClustersDeprecationAlert, {
provide: provideData,
stubs: {
GlSprintf,
},
});
};
beforeEach(() => {
createComponent();
});
afterEach(() => {
wrapper.destroy();
});
describe('template', () => {
it('should render a non-dismissible warning alert', () => {
expect(findAlert().props()).toMatchObject({
dismissible: false,
variant: 'warning',
});
});
it('should display the correct message', () => {
expect(findAlert().text()).toBe(message);
});
});
});
|