diff --git a/routes/apiHandlers.js b/routes/apiHandlers.js index 1311622e..2be94f38 100644 --- a/routes/apiHandlers.js +++ b/routes/apiHandlers.js @@ -170,7 +170,6 @@ async function handleRequestEmail( const existingUser = await database.findUser({ where: { email, - username, }, }); diff --git a/routes/apiHandlers.test.js b/routes/apiHandlers.test.js index 46ff125f..cb62ad13 100644 --- a/routes/apiHandlers.test.js +++ b/routes/apiHandlers.test.js @@ -77,7 +77,6 @@ describe('request email verification step', () => { { where: { email: 'foo@bar.com', - username: 'username', }, }, ], @@ -92,49 +91,6 @@ describe('request email verification step', () => { return new Promise(resolve => resolve()); }); - it('should let a user request an email verification who has tried before with the same name & email', async () => { - jest.mock('../db/models'); - jest.mock('../helpers/services'); - jest.mock('../helpers/database'); - const apiHandlers = require('./apiHandlers'); - const mockDb = require('../helpers/database'); - - mockDb.findUser = mockDb.findUserSuccessUnverified; - - const ret = await apiHandlers.handleRequestEmail( - 'ip', - 'recaptcha', - 'foo@bar.com', - 'fingerprint', - { query: 'string' }, - 'username', - 'xref', - 'protocol', - 'host' - ); - - // We should try to find an existing signup record matching this one's email and username. - expect(mockDb.findUser.mock.calls).toEqual([ - [ - { - where: { - email: 'foo@bar.com', - username: 'username', - }, - }, - ], - ]); - - // We should use the existing uesr and not create a new user record - expect(mockDb.createUser.mock.calls.length).toEqual(0); - expect(mockDb.createUserMockSave.mock.calls.length).toEqual(0); - expect(mockDb.findUserMockSave.mock.calls.length).toEqual(2); - - expect(ret.success).toEqual(true); - - return new Promise(resolve => resolve()); - }); - it('should not allow creating a user record with a username that has already been booked', async () => { jest.mock('../db/models'); jest.mock('../helpers/services');