fix tests
fix tests
This commit is contained in:
Generated
+9718
File diff suppressed because it is too large
Load Diff
@@ -31,7 +31,7 @@ describe('errorHandler', () => {
|
||||
const response = await request(app).get('/breaks');
|
||||
|
||||
expect(response.status).toBe(500);
|
||||
expect(response.text).toBe('some message');
|
||||
expect(response.body).toBe('some message');
|
||||
});
|
||||
|
||||
it('doesnt try to send the response again if its already been sent', async () => {
|
||||
@@ -52,7 +52,7 @@ describe('errorHandler', () => {
|
||||
const response = await request(app).get('/works_with_async_fail');
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.text).toBe('hello');
|
||||
expect(response.body).toBe('hello');
|
||||
|
||||
expect(mockSend).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -81,8 +81,7 @@ export function errorHandler(
|
||||
}
|
||||
|
||||
res.status(status);
|
||||
res.setHeader('content-type', 'text/plain');
|
||||
res.send(message);
|
||||
res.json(message);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user