debian-mirror-gitlab/spec/frontend/performance_bar/components/request_warning_spec.js

34 lines
948 B
JavaScript
Raw Normal View History

2019-12-21 20:55:43 +05:30
import { shallowMount } from '@vue/test-utils';
2020-01-01 13:55:28 +05:30
import RequestWarning from '~/performance_bar/components/request_warning.vue';
2019-12-21 20:55:43 +05:30
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', () => {
2020-11-24 15:15:51 +05:30
expect(wrapper.html()).toBe('');
2019-12-21 20:55:43 +05:30
});
});
});