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

32 lines
920 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 RequestSelector from '~/performance_bar/components/request_selector.vue';
2019-12-21 20:55:43 +05:30
describe('request selector', () => {
const requests = [
{
2020-01-01 13:55:28 +05:30
id: 'warningReq',
2020-03-13 15:44:24 +05:30
url: 'https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/1/discussions.json',
2020-01-01 13:55:28 +05:30
truncatedUrl: 'discussions.json',
2019-12-21 20:55:43 +05:30
hasWarnings: true,
},
];
const wrapper = shallowMount(RequestSelector, {
propsData: {
requests,
2020-01-01 13:55:28 +05:30
currentRequest: requests[0],
2019-12-21 20:55:43 +05:30
},
});
it('has a warning icon if any requests have warnings', () => {
expect(wrapper.find('span > gl-emoji').element.dataset.name).toEqual('warning');
});
it('adds a warning glyph to requests with warnings', () => {
2020-01-01 13:55:28 +05:30
const requestValue = wrapper.find('[value="warningReq"]').text();
2019-12-21 20:55:43 +05:30
expect(requestValue).toContain('discussions.json');
expect(requestValue).toContain('(!)');
});
});