Commit 1db7f899 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch...

Merge branch '259657-foss-broken-master-in-spec-frontend-vue_shared-components-members-avatars-user_avatar_spec-js' into 'master'

RUN AS-IF-FOSS Fix failing FOSS spec (`user_avatar_spec.js`) [RUN AS-IF-FOSS]

Closes #259657

See merge request gitlab-org/gitlab!44017
parents 0b413f7d d47c5c77
import { mount } from '@vue/test-utils';
import { GlBadge } from '@gitlab/ui';
import { member as memberMock } from 'jest/vue_shared/components/members/mock_data';
import UserAvatar from '~/vue_shared/components/members/avatars/user_avatar.vue';
describe('UserAvatar', () => {
let wrapper;
const createComponent = (propsData = {}) => {
wrapper = mount(UserAvatar, {
propsData: {
isCurrentUser: false,
...propsData,
},
});
};
afterEach(() => {
wrapper.destroy();
});
describe('badges', () => {
it.each`
member | badgeText
${{ ...memberMock, usingLicense: true }} | ${'Is using seat'}
${{ ...memberMock, groupSso: true }} | ${'SAML'}
${{ ...memberMock, groupManagedAccount: true }} | ${'Managed Account'}
`('renders the "$badgeText" badge', ({ member, badgeText }) => {
createComponent({ member });
expect(wrapper.find(GlBadge).text()).toBe(badgeText);
});
});
});
...@@ -4,7 +4,7 @@ import { GlAvatarLink, GlBadge } from '@gitlab/ui'; ...@@ -4,7 +4,7 @@ import { GlAvatarLink, GlBadge } from '@gitlab/ui';
import { member as memberMock, orphanedMember } from '../mock_data'; import { member as memberMock, orphanedMember } from '../mock_data';
import UserAvatar from '~/vue_shared/components/members/avatars/user_avatar.vue'; import UserAvatar from '~/vue_shared/components/members/avatars/user_avatar.vue';
describe('MemberList', () => { describe('UserAvatar', () => {
let wrapper; let wrapper;
const { user } = memberMock; const { user } = memberMock;
...@@ -68,11 +68,8 @@ describe('MemberList', () => { ...@@ -68,11 +68,8 @@ describe('MemberList', () => {
describe('badges', () => { describe('badges', () => {
it.each` it.each`
member | badgeText member | badgeText
${{ ...memberMock, usingLicense: true }} | ${'Is using seat'}
${{ ...memberMock, user: { ...memberMock.user, blocked: true } }} | ${'Blocked'} ${{ ...memberMock, user: { ...memberMock.user, blocked: true } }} | ${'Blocked'}
${{ ...memberMock, user: { ...memberMock.user, twoFactorEnabled: true } }} | ${'2FA'} ${{ ...memberMock, user: { ...memberMock.user, twoFactorEnabled: true } }} | ${'2FA'}
${{ ...memberMock, groupSso: true }} | ${'SAML'}
${{ ...memberMock, groupManagedAccount: true }} | ${'Managed Account'}
`('renders the "$badgeText" badge', ({ member, badgeText }) => { `('renders the "$badgeText" badge', ({ member, badgeText }) => {
createComponent({ member }); createComponent({ member });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment