blob: 88a5f4ea8b7f4bf2e273043c2c298821e804fedf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
import { GlAvatarLabeled } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import SidebarParticipant from '~/sidebar/components/assignees/sidebar_participant.vue';
const user = {
name: 'John Doe',
username: 'johndoe',
webUrl: '/link',
avatarUrl: '/avatar',
};
describe('Sidebar participant component', () => {
let wrapper;
const findAvatar = () => wrapper.findComponent(GlAvatarLabeled);
const createComponent = (status = null) => {
wrapper = shallowMount(SidebarParticipant, {
propsData: {
user: {
...user,
status,
},
},
});
};
afterEach(() => {
wrapper.destroy();
});
it('when user is not busy', () => {
createComponent();
expect(findAvatar().props('label')).toBe(user.name);
});
it('when user is busy', () => {
createComponent({ availability: 'BUSY' });
expect(findAvatar().props('label')).toBe(`${user.name} (Busy)`);
});
});
|