diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 23:02:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 23:02:30 +0300 |
commit | 41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch) | |
tree | 9c8d89a8624828992f06d892cd2f43818ff5dcc8 /spec/frontend/pages/projects/forks/new/components/fork_form_spec.js | |
parent | 0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff) |
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'spec/frontend/pages/projects/forks/new/components/fork_form_spec.js')
-rw-r--r-- | spec/frontend/pages/projects/forks/new/components/fork_form_spec.js | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/spec/frontend/pages/projects/forks/new/components/fork_form_spec.js b/spec/frontend/pages/projects/forks/new/components/fork_form_spec.js index dc5f1cb9e61..efbfd83a071 100644 --- a/spec/frontend/pages/projects/forks/new/components/fork_form_spec.js +++ b/spec/frontend/pages/projects/forks/new/components/fork_form_spec.js @@ -40,7 +40,9 @@ describe('ForkForm component', () => { }, ]; - const DEFAULT_PROPS = { + const DEFAULT_PROVIDE = { + newGroupPath: 'some/groups/path', + visibilityHelpPath: 'some/visibility/help/path', endpoint: '/some/project-full-path/-/forks/new.json', projectFullPath: '/some/project-full-path', projectId: '10', @@ -52,18 +54,14 @@ describe('ForkForm component', () => { }; const mockGetRequest = (data = {}, statusCode = httpStatus.OK) => { - axiosMock.onGet(DEFAULT_PROPS.endpoint).replyOnce(statusCode, data); + axiosMock.onGet(DEFAULT_PROVIDE.endpoint).replyOnce(statusCode, data); }; - const createComponentFactory = (mountFn) => (props = {}, data = {}) => { + const createComponentFactory = (mountFn) => (provide = {}, data = {}) => { wrapper = mountFn(ForkForm, { provide: { - newGroupPath: 'some/groups/path', - visibilityHelpPath: 'some/visibility/help/path', - }, - propsData: { - ...DEFAULT_PROPS, - ...props, + ...DEFAULT_PROVIDE, + ...provide, }, data() { return { @@ -111,7 +109,7 @@ describe('ForkForm component', () => { mockGetRequest(); createComponent(); - const { projectFullPath } = DEFAULT_PROPS; + const { projectFullPath } = DEFAULT_PROVIDE; const cancelButton = wrapper.find('[data-testid="cancel-button"]'); expect(cancelButton.attributes('href')).toBe(projectFullPath); @@ -130,10 +128,10 @@ describe('ForkForm component', () => { mockGetRequest(); createComponent(); - expect(findForkNameInput().attributes('value')).toBe(DEFAULT_PROPS.projectName); - expect(findForkSlugInput().attributes('value')).toBe(DEFAULT_PROPS.projectPath); + expect(findForkNameInput().attributes('value')).toBe(DEFAULT_PROVIDE.projectName); + expect(findForkSlugInput().attributes('value')).toBe(DEFAULT_PROVIDE.projectPath); expect(findForkDescriptionTextarea().attributes('value')).toBe( - DEFAULT_PROPS.projectDescription, + DEFAULT_PROVIDE.projectDescription, ); }); @@ -164,7 +162,7 @@ describe('ForkForm component', () => { it('make GET request from endpoint', async () => { await axios.waitForAll(); - expect(axiosMock.history.get[0].url).toBe(DEFAULT_PROPS.endpoint); + expect(axiosMock.history.get[0].url).toBe(DEFAULT_PROVIDE.endpoint); }); it('generate default option', async () => { @@ -469,7 +467,7 @@ describe('ForkForm component', () => { projectName, projectPath, projectVisibility, - } = DEFAULT_PROPS; + } = DEFAULT_PROVIDE; const url = `/api/${GON_API_VERSION}/projects/${projectId}/fork`; const project = { |