gitlab-org--gitlab-foss/spec/frontend/cycle_analytics/banner_spec.js

48 lines
1.2 KiB
JavaScript
Raw Normal View History

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');
2018-01-09 06:58:34 -05:00
expect(
wrapper
.find('p')
.text()
.trim()
2018-10-17 03:13:26 -04:00
.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.',
2018-10-17 03:13:26 -04:00
);
2018-10-09 14:03:09 -04:00
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();
});
});