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
44
45
46
47
48
49
50
51
52
53
54
55
56
|
import { GlEmptyState } from '@gitlab/ui';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import ReleasesEmptyState from '~/releases/components/releases_empty_state.vue';
describe('releases_empty_state.vue', () => {
const documentationPath = 'path/to/releases/documentation';
const illustrationPath = 'path/to/releases/empty/state/illustration';
let wrapper;
const createComponent = () => {
wrapper = shallowMountExtended(ReleasesEmptyState, {
provide: {
documentationPath,
illustrationPath,
},
});
};
beforeEach(() => {
createComponent();
});
afterEach(() => {
wrapper.destroy();
});
it('renders a GlEmptyState and provides it with the correct props', () => {
const emptyStateProps = wrapper.findComponent(GlEmptyState).props();
expect(emptyStateProps).toEqual(
expect.objectContaining({
title: ReleasesEmptyState.i18n.emptyStateTitle,
svgPath: illustrationPath,
}),
);
});
it('renders the empty state text', () => {
expect(wrapper.findByText(ReleasesEmptyState.i18n.emptyStateText).exists()).toBe(true);
});
it('renders a link to the documentation', () => {
const documentationLink = wrapper.findByText(ReleasesEmptyState.i18n.moreInformation);
expect(documentationLink.exists()).toBe(true);
expect(documentationLink.attributes()).toEqual(
expect.objectContaining({
'aria-label': ReleasesEmptyState.i18n.releasesDocumentation,
href: documentationPath,
target: '_blank',
}),
);
});
});
|