fix tests ugh
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 5m53s
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 5m53s
This commit is contained in:
@@ -246,9 +246,10 @@ describe('Admin Content Management Routes (/api/admin)', () => {
|
||||
});
|
||||
|
||||
it('PUT /comments/:id/status should return 400 for an invalid status', async () => {
|
||||
// Mock the database call to prevent it from executing. The route should validate
|
||||
// the status and return 400 before the DB is ever touched.
|
||||
vi.mocked(mockedDb.adminRepo.updateRecipeCommentStatus).mockRejectedValue(new Error('This should not be called'));
|
||||
// For this test, we do NOT mock the database call. The route handler should
|
||||
// validate the 'status' from the request body and return a 400 Bad Request
|
||||
// *before* any database interaction is attempted. If the mock were called,
|
||||
// it would indicate a logic error in the route.
|
||||
const response = await supertest(app).put('/api/admin/comments/301').send({ status: 'invalid-status' });
|
||||
expect(response.status).toBe(400);
|
||||
expect(response.body.message).toContain('A valid status');
|
||||
|
||||
Reference in New Issue
Block a user