test: fix auth test expectations and add test commands to Makefile
- Update auth.test.js to match current API error messages - Registration success message includes email verification notice - Duplicate credentials use generic message to prevent user enumeration - Add test commands to Makefile - make test: run all backend tests - make test-watch: run tests in watch mode - make test-coverage: run tests with coverage report All auth tests now pass (19/19 ✓)
This commit is contained in:
@@ -27,7 +27,7 @@ describe('Authentication API Tests', () => {
|
||||
.expect(201);
|
||||
|
||||
expect(response.body).toHaveProperty('success', true);
|
||||
expect(response.body).toHaveProperty('message', 'User registered successfully');
|
||||
expect(response.body).toHaveProperty('message', 'User registered successfully. Please check your email to verify your account.');
|
||||
expect(response.body.data).toHaveProperty('user');
|
||||
expect(response.body.data).toHaveProperty('token');
|
||||
expect(response.body.data.user).toHaveProperty('id');
|
||||
@@ -49,7 +49,7 @@ describe('Authentication API Tests', () => {
|
||||
.expect(400);
|
||||
|
||||
expect(response.body).toHaveProperty('success', false);
|
||||
expect(response.body).toHaveProperty('error', 'Email already registered');
|
||||
expect(response.body).toHaveProperty('error', 'An account with these credentials already exists. Please try logging in or use different credentials.');
|
||||
});
|
||||
|
||||
it('should reject registration with duplicate username', async () => {
|
||||
@@ -64,7 +64,7 @@ describe('Authentication API Tests', () => {
|
||||
.expect(400);
|
||||
|
||||
expect(response.body).toHaveProperty('success', false);
|
||||
expect(response.body).toHaveProperty('error', 'Username already taken');
|
||||
expect(response.body).toHaveProperty('error', 'An account with these credentials already exists. Please try logging in or use different credentials.');
|
||||
});
|
||||
|
||||
it('should reject registration with invalid email', async () => {
|
||||
|
||||
Reference in New Issue
Block a user