-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
0 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,6 @@ describe('request email verification step', () => { | |
{ | ||
where: { | ||
email: '[email protected]', | ||
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', | ||
'[email protected]', | ||
'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: '[email protected]', | ||
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'); | ||
|