2021-03-22 11:09:31 -04:00
|
|
|
import { shallowMount } from '@vue/test-utils';
|
|
|
|
import Banner from '~/cycle_analytics/components/banner.vue';
|
2017-10-09 03:45:51 -04:00
|
|
|
|
2020-11-26 07:09:48 -05:00
|
|
|
describe('Value Stream Analytics banner', () => {
|
2021-03-22 11:09:31 -04:00
|
|
|
let wrapper;
|
2017-10-09 03:45:51 -04:00
|
|
|
|
2021-03-22 11:09:31 -04:00
|
|
|
const createComponent = () => {
|
|
|
|
wrapper = shallowMount(Banner, {
|
|
|
|
propsData: {
|
|
|
|
documentationLink: 'path',
|
|
|
|
},
|
2017-10-09 03:45:51 -04:00
|
|
|
});
|
2021-03-22 11:09:31 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
createComponent();
|
2017-10-09 03:45:51 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
2021-03-22 11:09:31 -04:00
|
|
|
wrapper.destroy();
|
2017-10-09 03:45:51 -04:00
|
|
|
});
|
|
|
|
|
2020-02-07 16:08:39 -05:00
|
|
|
it('should render value stream analytics information', () => {
|
2021-03-22 11:09:31 -04:00
|
|
|
expect(wrapper.find('h4').text().trim()).toBe('Introducing Value Stream Analytics');
|
2018-01-09 06:58:34 -05:00
|
|
|
|
2017-10-09 03:45:51 -04:00
|
|
|
expect(
|
2021-03-22 11:09:31 -04:00
|
|
|
wrapper
|
|
|
|
.find('p')
|
|
|
|
.text()
|
|
|
|
.trim()
|
2018-10-17 03:13:26 -04:00
|
|
|
.replace(/[\r\n]+/g, ' '),
|
|
|
|
).toContain(
|
2020-02-07 16:08:39 -05:00
|
|
|
'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
|
|
|
|
2021-03-22 11:09:31 -04:00
|
|
|
expect(wrapper.find('a').text().trim()).toBe('Read more');
|
|
|
|
expect(wrapper.find('a').attributes('href')).toBe('path');
|
2017-10-09 03:45:51 -04:00
|
|
|
});
|
|
|
|
|
2021-03-22 11:09:31 -04:00
|
|
|
it('should emit an event when close button is clicked', async () => {
|
|
|
|
jest.spyOn(wrapper.vm, '$emit').mockImplementation(() => {});
|
2017-10-09 03:45:51 -04:00
|
|
|
|
2021-03-22 11:09:31 -04:00
|
|
|
await wrapper.find('.js-ca-dismiss-button').trigger('click');
|
2017-10-09 03:45:51 -04:00
|
|
|
|
2021-03-22 11:09:31 -04:00
|
|
|
expect(wrapper.vm.$emit).toHaveBeenCalled();
|
2017-10-09 03:45:51 -04:00
|
|
|
});
|
|
|
|
});
|