blob: 22644b97b4319eabeb1eaf59498d143395c69733 (
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
44
45
46
47
48
49
50
51
52
53
54
|
import { shallowMount } from '@vue/test-utils';
import MavenSettings from '~/packages_and_registries/settings/group/components/maven_settings.vue';
import SettingsTitles from '~/packages_and_registries/settings/group/components/settings_titles.vue';
describe('maven_settings', () => {
let wrapper;
const mountComponent = () => {
wrapper = shallowMount(MavenSettings, {
scopedSlots: {
default: '<div data-testid="default-slot">{{props.modelNames}}</div>',
},
});
};
const findSettingsTitle = () => wrapper.findComponent(SettingsTitles);
const findDefaultSlot = () => wrapper.find('[data-testid="default-slot"]');
afterEach(() => {
wrapper.destroy();
});
describe('title component', () => {
it('has a title component', () => {
mountComponent();
expect(findSettingsTitle().exists()).toBe(true);
});
it('passes the correct props', () => {
mountComponent();
expect(findSettingsTitle().props()).toMatchObject({
title: 'Maven',
subTitle: 'Settings for Maven packages',
});
});
});
describe('default slot', () => {
it('accept a default slots', () => {
mountComponent();
expect(findDefaultSlot().exists()).toBe(true);
});
it('binds model names', () => {
mountComponent();
expect(findDefaultSlot().text()).toContain('mavenDuplicatesAllowed');
expect(findDefaultSlot().text()).toContain('mavenDuplicateExceptionRegex');
});
});
});
|