-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(user): add test on weak password ✅
- Loading branch information
1 parent
94229e4
commit fbd1e7f
Showing
1 changed file
with
20 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,7 +85,7 @@ describe('User CRUD Unit Tests :', () => { | |
} | ||
}); | ||
|
||
test('should be able to register a new user', async () => { | ||
test('should not be able to register a new user with weak password', async () => { | ||
// Init user edited | ||
_userEdited.username = 'register_new_user'; | ||
_userEdited.email = '[email protected]'; | ||
|
@@ -116,6 +116,25 @@ describe('User CRUD Unit Tests :', () => { | |
} | ||
}); | ||
|
||
test('should be able to register a new user', async () => { | ||
// Init user edited | ||
_userEdited.username = 'register_new_user'; | ||
_userEdited.email = '[email protected]'; | ||
_userEdited.password = 'azerty'; | ||
|
||
try { | ||
const result = await agent.post('/api/auth/signup') | ||
.send(_userEdited) | ||
.expect(422); | ||
expect(result.body.type).toBe('error'); | ||
expect(result.body.message).toBe('schema validation error'); | ||
expect(result.body.error.details[0].message).toBe('password Password strength score 0 does not suffice the minimum of 3'); | ||
} catch (err) { | ||
console.log(err); | ||
expect(err).toBeFalsy(); | ||
} | ||
}); | ||
|
||
test('should not be able to login with wrong email', async () => { | ||
try { | ||
const result = await agent.post('/api/auth/signin') | ||
|