Skip to content

Commit 6e6bf8b

Browse files
committed
refactor: update IndexController response
1 parent ba4fb6f commit 6e6bf8b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/controllers/IndexController.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { Request, Response } from 'express';
22

33
const IndexController = (request: Request, response: Response): Response => {
4-
return response.json(['ok']);
4+
return response.json({
5+
status: 'ok',
6+
timestamp: new Date().toDateString(),
7+
});
58
};
69

710
export { IndexController };

tests/controllers/IndexController.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ describe('IndexController', () => {
1010

1111
IndexController(request as Request, response as unknown as Response);
1212

13-
expect(response.json).toBeCalledWith(['ok']);
13+
expect(response.json).toBeCalledWith({
14+
status: 'ok',
15+
timestamp: new Date().toDateString(),
16+
});
1417
});
1518
});

0 commit comments

Comments
 (0)