blob: ef7998c5ff50ead6bc80df30c5cd21d3b9a359f3 (
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
46
47
|
import { shallowMount } from '@vue/test-utils';
import Banner from '~/cycle_analytics/components/banner.vue';
describe('Value Stream Analytics banner', () => {
let wrapper;
const createComponent = () => {
wrapper = shallowMount(Banner, {
propsData: {
documentationLink: 'path',
},
});
};
beforeEach(() => {
createComponent();
});
afterEach(() => {
wrapper.destroy();
});
it('should render value stream analytics information', () => {
expect(wrapper.find('h4').text().trim()).toBe('Introducing Value Stream Analytics');
expect(
wrapper
.find('p')
.text()
.trim()
.replace(/[\r\n]+/g, ' '),
).toContain(
'Value Stream Analytics gives an overview of how much time it takes to go from idea to production in your project.',
);
expect(wrapper.find('a').text().trim()).toBe('Read more');
expect(wrapper.find('a').attributes('href')).toBe('path');
});
it('should emit an event when close button is clicked', async () => {
jest.spyOn(wrapper.vm, '$emit').mockImplementation(() => {});
await wrapper.find('.js-ca-dismiss-button').trigger('click');
expect(wrapper.vm.$emit).toHaveBeenCalled();
});
});
|