blob: 734b474c8fce54170539762bc5fb0f2fe98dab18 (
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
|
import { GlLink, GlIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import WorkItemCommentLocked from '~/work_items/components/notes/work_item_comment_locked.vue';
const createComponent = ({ workItemType = 'Task', isProjectArchived = false } = {}) =>
shallowMount(WorkItemCommentLocked, {
propsData: {
workItemType,
isProjectArchived,
},
});
describe('WorkItemCommentLocked', () => {
let wrapper;
const findLockedIcon = () => wrapper.findComponent(GlIcon);
const findLearnMoreLink = () => wrapper.findComponent(GlLink);
it('renders the locked icon', () => {
wrapper = createComponent();
expect(findLockedIcon().props('name')).toBe('lock');
});
it('has the learn more link', () => {
wrapper = createComponent();
expect(findLearnMoreLink().attributes('href')).toBe(
WorkItemCommentLocked.constantOptions.lockedIssueDocsPath,
);
});
describe('when the project is archived', () => {
beforeEach(() => {
wrapper = createComponent({ isProjectArchived: true });
});
it('learn more link is directed to archived project docs path', () => {
expect(findLearnMoreLink().attributes('href')).toBe(
WorkItemCommentLocked.constantOptions.archivedProjectDocsPath,
);
});
});
});
|