|
@@ -250,7 +250,7 @@ describe('UserRegistrationHandler', function() {
|
|
|
|
|
|
|
|
describe('registerNewUserAndSendActivationEmail', function() {
|
|
describe('registerNewUserAndSendActivationEmail', function() {
|
|
|
beforeEach(function() {
|
|
beforeEach(function() {
|
|
|
- this.email = 'email@example.com'
|
|
|
|
|
|
|
+ this.email = 'Email@example.com'
|
|
|
this.crypto.randomBytes = sinon.stub().returns({
|
|
this.crypto.randomBytes = sinon.stub().returns({
|
|
|
toString: () => {
|
|
toString: () => {
|
|
|
return (this.password = 'mock-password')
|
|
return (this.password = 'mock-password')
|
|
@@ -266,6 +266,7 @@ describe('UserRegistrationHandler', function() {
|
|
|
|
|
|
|
|
describe('with a new user', function() {
|
|
describe('with a new user', function() {
|
|
|
beforeEach(function() {
|
|
beforeEach(function() {
|
|
|
|
|
+ this.user.email = this.email.toLowerCase()
|
|
|
this.handler.registerNewUser.callsArgWith(1, null, this.user)
|
|
this.handler.registerNewUser.callsArgWith(1, null, this.user)
|
|
|
return this.handler.registerNewUserAndSendActivationEmail(
|
|
return this.handler.registerNewUserAndSendActivationEmail(
|
|
|
this.email,
|
|
this.email,
|
|
@@ -283,7 +284,10 @@ describe('UserRegistrationHandler', function() {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should generate a new password reset token', function() {
|
|
it('should generate a new password reset token', function() {
|
|
|
- const data = { user_id: this.user._id.toString(), email: this.email }
|
|
|
|
|
|
|
+ const data = {
|
|
|
|
|
+ user_id: this.user._id.toString(),
|
|
|
|
|
+ email: this.user.email
|
|
|
|
|
+ }
|
|
|
return this.OneTimeTokenHandler.getNewToken
|
|
return this.OneTimeTokenHandler.getNewToken
|
|
|
.calledWith('password', data, { expiresIn: 7 * 24 * 60 * 60 })
|
|
.calledWith('password', data, { expiresIn: 7 * 24 * 60 * 60 })
|
|
|
.should.equal(true)
|
|
.should.equal(true)
|