2021-11-23 15:11:19 +00:00
|
|
|
import { shallowMount } from '@vue/test-utils';
|
2022-03-24 12:07:26 +00:00
|
|
|
import Vue from 'vue';
|
2021-10-19 12:12:07 +00:00
|
|
|
import VueApollo from 'vue-apollo';
|
2022-03-24 12:07:26 +00:00
|
|
|
import WorkItemDetail from '~/work_items/components/work_item_detail.vue';
|
2021-10-19 12:12:07 +00:00
|
|
|
import WorkItemsRoot from '~/work_items/pages/work_item_root.vue';
|
|
|
|
|
2021-11-23 15:11:19 +00:00
|
|
|
Vue.use(VueApollo);
|
2021-10-19 12:12:07 +00:00
|
|
|
|
|
|
|
describe('Work items root component', () => {
|
|
|
|
let wrapper;
|
|
|
|
|
2022-03-24 12:07:26 +00:00
|
|
|
const findWorkItemDetail = () => wrapper.findComponent(WorkItemDetail);
|
2022-03-23 12:07:27 +00:00
|
|
|
|
2022-03-24 12:07:26 +00:00
|
|
|
const createComponent = () => {
|
2021-10-19 12:12:07 +00:00
|
|
|
wrapper = shallowMount(WorkItemsRoot, {
|
|
|
|
propsData: {
|
2022-03-24 12:07:26 +00:00
|
|
|
id: '1',
|
2021-10-19 12:12:07 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
wrapper.destroy();
|
2021-12-08 12:13:04 +00:00
|
|
|
});
|
|
|
|
|
2022-03-24 12:07:26 +00:00
|
|
|
it('renders WorkItemDetail', () => {
|
2022-03-23 12:07:27 +00:00
|
|
|
createComponent();
|
|
|
|
|
2022-03-24 12:07:26 +00:00
|
|
|
expect(findWorkItemDetail().props()).toEqual({ workItemId: 'gid://gitlab/WorkItem/1' });
|
2022-01-13 18:16:51 +00:00
|
|
|
});
|
2021-10-19 12:12:07 +00:00
|
|
|
});
|