debian-mirror-gitlab/spec/frontend/members/components/table/member_avatar_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-01-03 14:25:43 +05:30
import { shallowMount } from '@vue/test-utils';
2021-02-22 17:27:13 +05:30
import GroupAvatar from '~/members/components/avatars/group_avatar.vue';
import InviteAvatar from '~/members/components/avatars/invite_avatar.vue';
2021-03-11 19:13:27 +05:30
import UserAvatar from '~/members/components/avatars/user_avatar.vue';
import MemberAvatar from '~/members/components/table/member_avatar.vue';
import { MEMBER_TYPES } from '~/members/constants';
import { member as memberMock, group, invite, accessRequest } from '../../mock_data';
2021-01-03 14:25:43 +05:30
describe('MemberList', () => {
let wrapper;
2021-03-08 18:12:59 +05:30
const createComponent = (propsData) => {
2021-01-03 14:25:43 +05:30
wrapper = shallowMount(MemberAvatar, {
propsData: {
isCurrentUser: false,
...propsData,
},
});
};
2022-11-25 23:54:43 +05:30
it.each`
2021-01-03 14:25:43 +05:30
memberType | member | expectedComponent | expectedComponentName
${MEMBER_TYPES.user} | ${memberMock} | ${UserAvatar} | ${'UserAvatar'}
${MEMBER_TYPES.group} | ${group} | ${GroupAvatar} | ${'GroupAvatar'}
${MEMBER_TYPES.invite} | ${invite} | ${InviteAvatar} | ${'InviteAvatar'}
${MEMBER_TYPES.accessRequest} | ${accessRequest} | ${UserAvatar} | ${'UserAvatar'}
`(
'renders $expectedComponentName when `memberType` is $memberType',
({ memberType, member, expectedComponent }) => {
createComponent({ memberType, member });
2022-08-27 11:52:29 +05:30
expect(wrapper.findComponent(expectedComponent).exists()).toBe(true);
2021-01-03 14:25:43 +05:30
},
);
});