diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 15:12:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 15:12:47 +0300 |
commit | c984b0faf409dbe91a7998260fe4b8299cf21ad4 (patch) | |
tree | b1e434732c9d94ecaab0727f56a811b80a61a371 /spec/frontend/boards/components | |
parent | bd28d0fa02dc73794e013159512900f8d10fa10b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/boards/components')
-rw-r--r-- | spec/frontend/boards/components/board_form_spec.js | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/spec/frontend/boards/components/board_form_spec.js b/spec/frontend/boards/components/board_form_spec.js index f8154145d43..3302fb2ce43 100644 --- a/spec/frontend/boards/components/board_form_spec.js +++ b/spec/frontend/boards/components/board_form_spec.js @@ -59,18 +59,14 @@ describe('BoardForm', () => { }, }); - const createComponent = (props, data) => { + const createComponent = (props, provide) => { wrapper = shallowMountExtended(BoardForm, { propsData: { ...defaultProps, ...props }, - data() { - return { - ...data, - }; - }, provide: { boardBaseUrl: 'root', isGroupBoard: true, isProjectBoard: false, + ...provide, }, mocks: { $apollo: { @@ -209,6 +205,30 @@ describe('BoardForm', () => { expect(setBoardMock).not.toHaveBeenCalled(); expect(setErrorMock).toHaveBeenCalled(); }); + + describe('when Apollo boards FF is on', () => { + it('calls a correct GraphQL mutation and emits addBoard event', async () => { + createComponent( + { canAdminBoard: true, currentPage: formType.new }, + { isApolloBoard: true }, + ); + fillForm(); + + await waitForPromises(); + + expect(mutate).toHaveBeenCalledWith({ + mutation: createBoardMutation, + variables: { + input: expect.objectContaining({ + name: 'test', + }), + }, + }); + + await waitForPromises(); + expect(wrapper.emitted('addBoard')).toHaveLength(1); + }); + }); }); }); |