blob: e435c0dcc0891d31de877741ea991aaa8f9a8acf (
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 { getByRole } from '@testing-library/dom';
import { mount } from '@vue/test-utils';
import FirstPipelineCard from '~/pipeline_editor/components/drawer/cards/first_pipeline_card.vue';
describe('First pipeline card', () => {
let wrapper;
const defaultProvide = {
runnerHelpPagePath: '/help/runners',
};
const createComponent = () => {
wrapper = mount(FirstPipelineCard, {
provide: {
...defaultProvide,
},
});
};
const getLinkByName = (name) => getByRole(wrapper.element, 'link', { name }).href;
const findRunnersLink = () => getLinkByName(/make sure your instance has runners available/i);
const findInstructionsList = () => wrapper.find('ol');
const findAllInstructions = () => findInstructionsList().findAll('li');
beforeEach(() => {
createComponent();
});
afterEach(() => {
wrapper.destroy();
});
it('renders the title', () => {
expect(wrapper.text()).toContain(wrapper.vm.$options.i18n.title);
});
it('renders the content', () => {
expect(findInstructionsList().exists()).toBe(true);
expect(findAllInstructions()).toHaveLength(3);
});
it('renders the link', () => {
expect(findRunnersLink()).toContain(defaultProvide.runnerHelpPagePath);
});
});
|