Skip to content

Commit 6b2b63f

Browse files
committed
Update getInterviews test
1 parent ccafec6 commit 6b2b63f

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

tests/Interview.test.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ import { Verdict } from '../src/generated/prisma';
55

66
describe('getInterviews', () => {
77
it('should return 200 and all interviews', async () => {
8-
const req: any = {};
8+
const req: any = {
9+
query: {
10+
page: '1',
11+
limit: '10',
12+
},
13+
};
914
const res: any = {
1015
status: jest.fn().mockReturnThis(),
1116
json: jest.fn(),
@@ -19,25 +24,37 @@ describe('getInterviews', () => {
1924
verdict: Verdict.Selected,
2025
content: 'Great experience',
2126
isAnonymous: false,
22-
memberId: 'member123',
27+
member: {
28+
id: 'member123',
29+
name: 'John Doe',
30+
profilePhoto: null,
31+
},
2332
},
2433
];
2534

35+
const mockReturn = {
36+
interviews: mockInterviews,
37+
total: 1,
38+
};
39+
2640
jest
2741
.spyOn(interviewService, 'getInterviews')
28-
.mockResolvedValue(mockInterviews);
42+
.mockResolvedValue(mockReturn);
2943

3044
await getInterviews(req, res);
3145

3246
expect(res.status).toHaveBeenCalledWith(200);
3347
expect(res.json).toHaveBeenCalledWith({
3448
success: true,
3549
data: mockInterviews,
50+
page: 1,
51+
limit: 10,
52+
total: 1,
53+
totalPages: Math.ceil(1 / 10),
3654
});
3755
});
3856
});
3957

40-
4158
describe('getInterviewById', () => {
4259
it('should return 200 and the interview if found', async () => {
4360
const req: any = {

0 commit comments

Comments
 (0)