Skip to content

Commit

Permalink
revert fix for #265
Browse files Browse the repository at this point in the history
  • Loading branch information
bnchdrff committed May 8, 2018
1 parent c06291d commit c8a537e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
1 change: 0 additions & 1 deletion routes/apiHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ async function handleRequestEmail(
const existingUser = await database.findUser({
where: {
email,
username,
},
});

Expand Down
44 changes: 0 additions & 44 deletions routes/apiHandlers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ describe('request email verification step', () => {
{
where: {
email: '[email protected]',
username: 'username',
},
},
],
Expand All @@ -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');
Expand Down

0 comments on commit c8a537e

Please sign in to comment.