2019-09-30 21:06:41 +00:00
|
|
|
import { shallowMount } from '@vue/test-utils';
|
2019-12-09 12:07:58 +00:00
|
|
|
import RequestWarning from '~/performance_bar/components/request_warning.vue';
|
2019-09-30 21:06:41 +00:00
|
|
|
|
|
|
|
describe('request warning', () => {
|
|
|
|
const htmlId = 'request-123';
|
|
|
|
|
|
|
|
describe('when the request has warnings', () => {
|
|
|
|
const wrapper = shallowMount(RequestWarning, {
|
|
|
|
propsData: {
|
|
|
|
htmlId,
|
|
|
|
warnings: ['gitaly calls: 30 over 10', 'gitaly duration: 1500 over 1000'],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
it('adds a warning emoji with the correct ID', () => {
|
|
|
|
expect(wrapper.find('span[id]').attributes('id')).toEqual(htmlId);
|
|
|
|
expect(wrapper.find('span[id] gl-emoji').element.dataset.name).toEqual('warning');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('when the request does not have warnings', () => {
|
|
|
|
const wrapper = shallowMount(RequestWarning, {
|
|
|
|
propsData: {
|
|
|
|
htmlId,
|
|
|
|
warnings: [],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
it('does nothing', () => {
|
|
|
|
expect(wrapper.isEmpty()).toBe(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|