Skip to content

Commit

Permalink
Otro arreglo
Browse files Browse the repository at this point in the history
  • Loading branch information
uo277310 committed Apr 24, 2024
1 parent bcd7961 commit 9253f89
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions users/userservice/user-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ describe('User Service', () => {
username: process.env.TEST_USER,
password: process.env.TEST_PASSWORD,
};


// Mock the User.findOne method to return null (no existing user with the same username)
User.findOne.mockResolvedValue(null);

// Mock the User.create method
User.create.mockResolvedValue({
_id: 'some-id', // Add any necessary properties here
username: newUser.username,
password: newUser.password,
});

const response = await request(app).post('/adduser').send(newUser);
expect(response.status).toBe(200);
expect(response.body).toHaveProperty('username', newUser.username);
Expand Down

0 comments on commit 9253f89

Please # to comment.