Skip to content

Commit

Permalink
Revert "User service test fixed"
Browse files Browse the repository at this point in the history
This reverts commit 7d57ea5.
  • Loading branch information
ChristianFN2 committed Apr 7, 2024
1 parent 7d57ea5 commit 21a3574
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
3 changes: 1 addition & 2 deletions users/userservice/user-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ app.post('/adduser', async (req, res) => {
});

await newUser.save();
res.status(200).json(newUser);
res.json(newUser);
} catch (error) {
console.log(error)
res.status(400).json({ error: error.message });
}});

Expand Down
9 changes: 2 additions & 7 deletions users/userservice/user-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,11 @@ describe('User Service', () => {
it('should add a new user on POST /adduser', async () => {
const newUser = {
username: 'testuser',
email: 'testemail',
password: 'testpassword',
};

const response = await request(app)
.post('/adduser')
.send(newUser);
const response = await request(app).post('/adduser').send(newUser);
expect(response.status).toBe(200);
expect(response.body).toHaveProperty('username', newUser.username);
expect(response.body).toHaveProperty('email', newUser.email);
expect(response.body.password).not.toBe(newUser.password);
expect(response.body).toHaveProperty('username', 'testuser');
});
});

0 comments on commit 21a3574

Please sign in to comment.