blob: aeb85694e604704e6bebe945132c323f60bfe975 (
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
|
import { GlAlert, GlLink } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import UnmetPrerequisitesBlock from '~/jobs/components/unmet_prerequisites_block.vue';
describe('Unmet Prerequisites Block Job component', () => {
let wrapper;
const helpPath = '/user/project/clusters/index.html#troubleshooting-failed-deployment-jobs';
const createComponent = () => {
wrapper = shallowMount(UnmetPrerequisitesBlock, {
propsData: {
helpPath,
},
});
};
beforeEach(() => {
createComponent();
});
afterEach(() => {
wrapper.destroy();
});
it('renders an alert with the correct message', () => {
const container = wrapper.find(GlAlert);
const alertMessage =
'This job failed because the necessary resources were not successfully created.';
expect(container).not.toBeNull();
expect(container.text()).toContain(alertMessage);
});
it('renders link to help page', () => {
const helpLink = wrapper.find(GlLink);
expect(helpLink).not.toBeNull();
expect(helpLink.text()).toContain('More information');
expect(helpLink.attributes().href).toEqual(helpPath);
});
});
|