Refactor: Update error messages in user routes tests for clarity and consistency
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 11m44s
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 11m44s
This commit is contained in:
@@ -186,7 +186,7 @@ describe('User Routes (/api/users)', () => {
|
||||
.send({ category: 'Produce' });
|
||||
expect(response.status).toBe(400);
|
||||
// Check the 'errors' array for the specific validation message.
|
||||
expect(response.body.errors[0].message).toContain("expected string, received undefined");
|
||||
expect(response.body.errors[0].message).toBe("Field 'itemName' is required.");
|
||||
});
|
||||
|
||||
it('should return 400 if category is missing', async () => {
|
||||
@@ -195,7 +195,7 @@ describe('User Routes (/api/users)', () => {
|
||||
.send({ itemName: 'Apples' });
|
||||
expect(response.status).toBe(400);
|
||||
// Check the 'errors' array for the specific validation message.
|
||||
expect(response.body.errors[0].message).toContain("expected string, received undefined");
|
||||
expect(response.body.errors[0].message).toBe("Field 'category' is required.");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -240,7 +240,7 @@ describe('User Routes (/api/users)', () => {
|
||||
const response = await supertest(app).post('/api/users/shopping-lists').send({});
|
||||
expect(response.status).toBe(400);
|
||||
// Check the 'errors' array for the specific validation message.
|
||||
expect(response.body.errors[0].message).toContain("expected string, received undefined");
|
||||
expect(response.body.errors[0].message).toBe("Field 'name' is required.");
|
||||
});
|
||||
|
||||
it('should return 400 on foreign key constraint error', async () => {
|
||||
|
||||
Reference in New Issue
Block a user