debian-mirror-gitlab/spec/frontend/pages/groups/new/components/app_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
1.6 KiB
JavaScript
Raw Normal View History

2022-08-27 11:52:29 +05:30
import { shallowMount } from '@vue/test-utils';
import App from '~/pages/groups/new/components/app.vue';
import NewNamespacePage from '~/vue_shared/new_namespace/new_namespace_page.vue';
describe('App component', () => {
let wrapper;
const createComponent = (propsData = {}) => {
2023-06-20 00:43:36 +05:30
wrapper = shallowMount(App, {
propsData: { rootPath: '/', groupsUrl: '/dashboard/groups', ...propsData },
});
2022-08-27 11:52:29 +05:30
};
const findNewNamespacePage = () => wrapper.findComponent(NewNamespacePage);
const findCreateGroupPanel = () =>
findNewNamespacePage()
.props('panels')
.find((panel) => panel.name === 'create-group-pane');
it('creates correct component for group creation', () => {
createComponent();
2023-05-27 22:25:52 +05:30
expect(findNewNamespacePage().props('initialBreadcrumbs')).toEqual([
2023-06-20 00:43:36 +05:30
{ href: '/', text: 'Your work' },
2023-05-27 22:25:52 +05:30
{ href: '/dashboard/groups', text: 'Groups' },
{ href: '#', text: 'New group' },
]);
2022-08-27 11:52:29 +05:30
expect(findCreateGroupPanel().title).toBe('Create group');
});
it('creates correct component for subgroup creation', () => {
2023-05-27 22:25:52 +05:30
const detailProps = {
parentGroupName: 'parent',
importExistingGroupPath: '/path',
};
const props = { ...detailProps, parentGroupUrl: '/parent' };
2022-08-27 11:52:29 +05:30
createComponent(props);
2023-05-27 22:25:52 +05:30
expect(findNewNamespacePage().props('initialBreadcrumbs')).toEqual([
{ href: '/parent', text: 'parent' },
{ href: '#', text: 'New subgroup' },
]);
2022-08-27 11:52:29 +05:30
expect(findCreateGroupPanel().title).toBe('Create subgroup');
2023-05-27 22:25:52 +05:30
expect(findCreateGroupPanel().detailProps).toEqual(detailProps);
2022-08-27 11:52:29 +05:30
});
});