debian-mirror-gitlab/spec/frontend/sidebar/components/assignees/collapsed_assignee_spec.js

44 lines
1 KiB
JavaScript
Raw Normal View History

2021-09-30 23:02:18 +05:30
import { mount } from '@vue/test-utils';
2019-12-04 20:38:33 +05:30
import AssigneeAvatar from '~/sidebar/components/assignees/assignee_avatar.vue';
2021-03-11 19:13:27 +05:30
import CollapsedAssignee from '~/sidebar/components/assignees/collapsed_assignee.vue';
2019-12-04 20:38:33 +05:30
import userDataMock from '../../user_data_mock';
const TEST_USER = userDataMock();
const TEST_ISSUABLE_TYPE = 'merge_request';
describe('CollapsedAssignee assignee component', () => {
let wrapper;
function createComponent(props = {}) {
const propsData = {
user: userDataMock(),
issuableType: TEST_ISSUABLE_TYPE,
...props,
};
2021-09-30 23:02:18 +05:30
wrapper = mount(CollapsedAssignee, {
2019-12-04 20:38:33 +05:30
propsData,
});
}
afterEach(() => {
wrapper.destroy();
});
it('has author name', () => {
createComponent();
2021-03-08 18:12:59 +05:30
expect(wrapper.find('.author').text().trim()).toEqual(TEST_USER.name);
2019-12-04 20:38:33 +05:30
});
it('has assignee avatar', () => {
createComponent();
expect(wrapper.find(AssigneeAvatar).props()).toEqual({
imgSize: 24,
user: TEST_USER,
issuableType: TEST_ISSUABLE_TYPE,
});
});
});