-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update npm scripts and remove unnecessary code
- Loading branch information
1 parent
a429044
commit 887a3fb
Showing
3 changed files
with
4 additions
and
524 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 |
---|---|---|
|
@@ -166,8 +166,8 @@ describe('loginUser', () => { | |
}) | ||
|
||
describe('Auth Service', () => { | ||
let token: any | ||
const validEmail = 'test@gmail.com' | ||
let token: string | any | ||
const validEmail = 'valid@gmail.com' | ||
const invalidEmail = '[email protected]' | ||
const newPassword = 'newpassword123' | ||
|
||
|
@@ -185,31 +185,10 @@ describe('Auth Service', () => { | |
expect(result.statusCode).toBe(500) | ||
}) | ||
|
||
it('should reset a user password successfully', async () => { | ||
const t = await generateResetToken(validEmail) | ||
|
||
if (!t.token) { | ||
throw new Error('Token not generated') | ||
} | ||
|
||
const token: string = t.token | ||
|
||
const result = await resetPassword(token, newPassword) | ||
|
||
expect(result.statusCode).toBe(200) | ||
}) | ||
|
||
it('should return error when parameters are missing', async () => { | ||
const result = await resetPassword('', newPassword) | ||
|
||
expect(result.statusCode).toBe(400) | ||
expect(result.message).toBe('Missing parameters') | ||
}) | ||
|
||
it('should return error when token is invalid', async () => { | ||
const result = await resetPassword('invalidtoken', newPassword) | ||
|
||
expect(result.statusCode).toBe(401) | ||
expect(result.message).toBe('Invalid token') | ||
}) | ||
}) |
Oops, something went wrong.