debian-mirror-gitlab/spec/frontend/projects/components/project_delete_button_spec.js

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

58 lines
1.5 KiB
JavaScript
Raw Normal View History

2020-10-24 23:57:45 +05:30
import { shallowMount } from '@vue/test-utils';
2021-12-11 22:18:48 +05:30
import { GlSprintf } from '@gitlab/ui';
2020-10-24 23:57:45 +05:30
import ProjectDeleteButton from '~/projects/components/project_delete_button.vue';
import SharedDeleteButton from '~/projects/components/shared/delete_button.vue';
jest.mock('lodash/uniqueId', () => () => 'fakeUniqueId');
describe('Project remove modal', () => {
let wrapper;
2022-10-11 01:57:18 +05:30
const findSharedDeleteButton = () => wrapper.findComponent(SharedDeleteButton);
2020-10-24 23:57:45 +05:30
const defaultProps = {
confirmPhrase: 'foo',
formPath: 'some/path',
2021-12-11 22:18:48 +05:30
isFork: false,
issuesCount: 1,
mergeRequestsCount: 2,
forksCount: 3,
starsCount: 4,
2020-10-24 23:57:45 +05:30
};
const createComponent = (props = {}) => {
wrapper = shallowMount(ProjectDeleteButton, {
propsData: {
...defaultProps,
...props,
},
stubs: {
2021-12-11 22:18:48 +05:30
GlSprintf,
2020-10-24 23:57:45 +05:30
SharedDeleteButton,
},
});
};
describe('initialized', () => {
beforeEach(() => {
createComponent();
});
it('matches the snapshot', () => {
expect(wrapper.element).toMatchSnapshot();
});
it('passes confirmPhrase and formPath props to the shared delete button', () => {
2021-12-11 22:18:48 +05:30
expect(findSharedDeleteButton().props()).toEqual({
confirmPhrase: defaultProps.confirmPhrase,
2022-04-04 11:22:00 +05:30
forksCount: defaultProps.forksCount,
2021-12-11 22:18:48 +05:30
formPath: defaultProps.formPath,
2022-04-04 11:22:00 +05:30
isFork: defaultProps.isFork,
issuesCount: defaultProps.issuesCount,
mergeRequestsCount: defaultProps.mergeRequestsCount,
starsCount: defaultProps.starsCount,
2021-12-11 22:18:48 +05:30
});
2020-10-24 23:57:45 +05:30
});
});
});