0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 14:12:40 +00:00

Update dbCheck test

This commit is contained in:
G.Ambatte
2025-09-02 21:08:15 +12:00
parent 4fca207e0e
commit d6a7d0272a

View File

@@ -36,17 +36,9 @@ describe('database check middleware', ()=>{
mongoose.connection.readyState = 99;
dbCheck(request, response);
expect(()=>{dbCheck(request, response);}).toThrow(new Error('Unable to connect to database'));
mongoose.connection.readyState = dbState;
expect(response.status).toHaveBeenLastCalledWith(503);
expect(response.send).toHaveBeenLastCalledWith(
expect.objectContaining({
message : 'Unable to connect to database',
state : 99
})
);
});
it('should call next if readystate == 1', ()=>{