-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed issues in org route and added new tests
- Loading branch information
Showing
2 changed files
with
35 additions
and
3 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 |
---|---|---|
|
@@ -185,6 +185,38 @@ test('Should not get profile for unauthenticated user', async () => { | |
.expect(HttpStatus.UNAUTHORIZED) | ||
}) | ||
|
||
/** Should update user profile */ | ||
test('Should update profile or authenticated user', async () => { | ||
await request(app) | ||
.patch('/user/me') | ||
.set('Authorization', `Bearer ${testUser.tokens[0].token}`) | ||
.send({ | ||
email: '[email protected]' | ||
}) | ||
.expect(HttpStatus.OK) | ||
}) | ||
|
||
/** Should fail to make updates that are not allowed to user profile */ | ||
test('Should be able to make only allowed updates to authenticated user', async () => { | ||
await request(app) | ||
.patch('/user/me') | ||
.set('Authorization', `Bearer ${testUser.tokens[0].token}`) | ||
.send({ | ||
gender: 'Male' | ||
}) | ||
.expect(HttpStatus.BAD_REQUEST) | ||
}) | ||
|
||
/** Should Fail updating profile of unauthenticate user */ | ||
test('Should not update profile or unauthenticated user', async () => { | ||
await request(app) | ||
.patch('/user/me') | ||
.send({ | ||
email: '[email protected]' | ||
}) | ||
.expect(HttpStatus.UNAUTHORIZED) | ||
}) | ||
|
||
/** Delete authenticated user profile */ | ||
test('Should delete profile of authenticated user', async () => { | ||
await request(app) | ||
|