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
46
47
48
49
50
51
52
|
import { shallowMount } from '@vue/test-utils';
import EmptyState from '~/pipelines/components/pipelines_list/empty_state.vue';
describe('Pipelines Empty State', () => {
let wrapper;
const findGetStartedButton = () => wrapper.find('[data-testid="get-started-pipelines"]');
const findInfoText = () => wrapper.find('[data-testid="info-text"]').text();
const createWrapper = () => {
wrapper = shallowMount(EmptyState, {
propsData: {
helpPagePath: 'foo',
emptyStateSvgPath: 'foo',
canSetCi: true,
},
});
};
describe('renders', () => {
beforeEach(() => {
createWrapper();
});
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
it('should render empty state SVG', () => {
expect(wrapper.find('img').attributes('src')).toBe('foo');
});
it('should render empty state header', () => {
expect(wrapper.find('[data-testid="header-text"]').text()).toBe('Build with confidence');
});
it('should render a link with provided help path', () => {
expect(findGetStartedButton().attributes('href')).toBe('foo');
});
it('should render empty state information', () => {
expect(findInfoText()).toContain(
'Continuous Integration can help catch bugs by running your tests automatically',
'while Continuous Deployment can help you deliver code to your product environment',
);
});
it('should render a button', () => {
expect(findGetStartedButton().text()).toBe('Get started with Pipelines');
});
});
});
|