Skip to content

Commit

Permalink
test: resolve failing test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
shishirbychapur committed Sep 23, 2024
1 parent 7b22a74 commit 0ad6121
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/user-service/__tests__/routes/user.routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,22 +177,22 @@ describe('User Routes', () => {
})
})

describe('PUT /users/password/:id', () => {
describe('PUT /users/:id/password', () => {
it('should return 200 for successful update', async () => {
const user1 = await request(app).post('/users').send(CREATE_USER_DTO1)
const response = await request(app).put(`/users/password/${user1.body.id}`).send({
const response = await request(app).put(`/users/${user1.body.id}/password`).send({
password: 'Test12345!',
})
expect(response.status).toBe(200)
expect(response.body.password).not.toEqual(user1.body.password)
})
it('should return 400 for requests with invalid ids', async () => {
const response = await request(app).put('/users/password/111').send()
const response = await request(app).put('/users/111/password').send()
expect(response.status).toBe(400)
})
it('should return 400 for requests with invalid passwords', async () => {
const user1 = await request(app).post('/users').send(CREATE_USER_DTO1)
const response = await request(app).put(`/users/password/${user1.body.id}`).send({
const response = await request(app).put(`/users/${user1.body.id}/password`).send({
password: 'Test1234',
})
expect(response.status).toBe(400)
Expand Down

0 comments on commit 0ad6121

Please sign in to comment.