Skip to content
Snippets Groups Projects
Commit 8e46e2c0 authored by Anca Ursachi's avatar Anca Ursachi
Browse files

test(changePassword.test): Repair some tests after some minor changes in the file changePassword.

parent f86946d2
No related branches found
No related tags found
3 merge requests!196S25 - EiC submit revision,!189S25,!183Hin 961 strong password
...@@ -13,8 +13,8 @@ jest.mock('@pubsweet/component-send-email', () => ({ ...@@ -13,8 +13,8 @@ jest.mock('@pubsweet/component-send-email', () => ({
})) }))
const reqBody = { const reqBody = {
password: 'password', currentPassword: 'password',
newPassword: 'N3wPassword!', password: 'N3wPassword!',
} }
const notFoundError = new Error() const notFoundError = new Error()
...@@ -44,7 +44,7 @@ describe('Users password reset route handler', () => { ...@@ -44,7 +44,7 @@ describe('Users password reset route handler', () => {
expect(data.error).toEqual('Missing required params.') expect(data.error).toEqual('Missing required params.')
}) })
it('should return an error when the password is too small', async () => { it('should return an error when the password is too small', async () => {
body.newPassword = 'small' body.password = 'small'
const req = httpMocks.createRequest({ body }) const req = httpMocks.createRequest({ body })
req.user = user.id req.user = user.id
...@@ -67,7 +67,7 @@ describe('Users password reset route handler', () => { ...@@ -67,7 +67,7 @@ describe('Users password reset route handler', () => {
expect(data.error).toEqual('User not found') expect(data.error).toEqual('User not found')
}) })
it('should return an error when the current password is incorrect', async () => { it('should return an error when the current password is incorrect', async () => {
body.password = 'invalid-password' body.currentPassword = 'invalid-password'
const req = httpMocks.createRequest({ body }) const req = httpMocks.createRequest({ body })
req.user = user.id req.user = user.id
...@@ -90,6 +90,6 @@ describe('Users password reset route handler', () => { ...@@ -90,6 +90,6 @@ describe('Users password reset route handler', () => {
savedUser.validPassword = user.validPassword savedUser.validPassword = user.validPassword
expect(savedUser.token).not.toEqual(user.token) expect(savedUser.token).not.toEqual(user.token)
expect(savedUser.validPassword(body.newPassword)).toBeTruthy() expect(savedUser.validPassword(body.password)).toBeTruthy()
}) })
}) })
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment