diff --git a/src/__test__/userController.test.ts b/src/__test__/userController.test.ts index eeec160a..03e8609e 100644 --- a/src/__test__/userController.test.ts +++ b/src/__test__/userController.test.ts @@ -42,6 +42,17 @@ describe('User Registration Tests', () => { }); it('should return a 409 status code if the email already exists', async () => { + // Setup: Ensure a user with the specified email exists + const existingUserData = { + firstName: 'Existing', + lastName: 'User', + email: 'test@gmail.com', + password: 'ExistingPassword123', + userType: 'buyer', + }; + await request(app).post('/api/v1/register').send(existingUserData); + + // Test: Attempt to register a new user with the same email const userData = { firstName: 'Existing', lastName: 'User',