diff --git a/webapp/components/Registration/Signup.spec.js b/webapp/components/Registration/Signup.spec.js index 23934be23..36b16903c 100644 --- a/webapp/components/Registration/Signup.spec.js +++ b/webapp/components/Registration/Signup.spec.js @@ -58,7 +58,8 @@ describe('Signup', () => { it('delivers email to backend', () => { const expected = expect.objectContaining({ - variables: { email: 'mAIL@exAMPLE.org', token: null }, + mutation: SignupMutation, + variables: { email: 'mAIL@exAMPLE.org', inviteCode: null }, }) expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) }) @@ -84,45 +85,5 @@ describe('Signup', () => { }) }) }) - - describe('with invitation code', () => { - let action - beforeEach(() => { - propsData.token = '666777' - action = async () => { - wrapper = Wrapper() - wrapper.find('input#email').setValue('mail@example.org') - await wrapper.find('form').trigger('submit') - await wrapper.html() - } - }) - - describe('submit', () => { - it('delivers invitation token to backend', async () => { - await action() - const expected = expect.objectContaining({ - variables: { email: 'mail@example.org', token: '666777' }, - }) - expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) - }) - - describe('in case a user account with the email already exists', () => { - beforeEach(() => { - mocks.$apollo.mutate = jest - .fn() - .mockRejectedValue( - new Error('UserInputError: A user account with this email already exists.'), - ) - }) - - it('explains the error', async () => { - await action() - expect(mocks.$t).toHaveBeenCalledWith( - 'components.registration.signup.form.errors.email-exists', - ) - }) - }) - }) - }) }) }) diff --git a/webapp/components/Registration/Signup.vue b/webapp/components/Registration/Signup.vue index 607dafad6..b0d8b4111 100644 --- a/webapp/components/Registration/Signup.vue +++ b/webapp/components/Registration/Signup.vue @@ -119,7 +119,7 @@ export default { try { const response = await this.$apollo.mutate({ - SignupMutation, + mutation: SignupMutation, variables: { email, inviteCode: null }, }) this.data = response.data diff --git a/webapp/pages/registration.spec.js b/webapp/pages/registration.spec.js index d0fd3b80a..001f07ee5 100644 --- a/webapp/pages/registration.spec.js +++ b/webapp/pages/registration.spec.js @@ -147,5 +147,47 @@ describe('Registration', () => { }) }) }) + + // Wolle copied from webapp/components/Registration/Signup.spec.js as testing template + // describe('with invitation code', () => { + // let action + // beforeEach(() => { + // propsData.token = '12345' + // action = async () => { + // wrapper = Wrapper() + // wrapper.find('input#email').setValue('mail@example.org') + // await wrapper.find('form').trigger('submit') + // await wrapper.html() + // } + // }) + + // describe('submit', () => { + // it('delivers invitation code to backend', async () => { + // await action() + // const expected = expect.objectContaining({ + // mutation: SignupMutation, + // variables: { email: 'mail@example.org', inviteCode: '12345' }, + // }) + // expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) + // }) + + // describe('in case a user account with the email already exists', () => { + // beforeEach(() => { + // mocks.$apollo.mutate = jest + // .fn() + // .mockRejectedValue( + // new Error('UserInputError: A user account with this email already exists.'), + // ) + // }) + + // it('explains the error', async () => { + // await action() + // expect(mocks.$t).toHaveBeenCalledWith( + // 'components.registration.signup.form.errors.email-exists', + // ) + // }) + // }) + // }) + // }) }) })