Skip to content

Commit 9f5bf2c

Browse files
fix unit test
1 parent 56f8558 commit 9f5bf2c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/users/users.controller.spec.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe("User Controller", () => {
5151
email: "te@test.com",
5252
email_code: "eee",
5353
activation_code: "e",
54-
}
54+
},
5555
];
5656

5757
beforeEach(async () => {
@@ -68,7 +68,7 @@ describe("User Controller", () => {
6868
{
6969
provide: JwtService,
7070
useValue: {
71-
create: jest.fn().mockResolvedValue(true)
71+
create: jest.fn().mockResolvedValue(true),
7272
},
7373
},
7474
],
@@ -89,10 +89,13 @@ describe("User Controller", () => {
8989
expect(createSpy).toHaveBeenCalledWith(createUserDto);
9090
});
9191

92-
it('should return an array of users', async () => {
92+
it("should return an array of users", async () => {
9393
let response: MockResponse<Response> = createResponse();
9494
response.json = jest.fn();
95-
expect(controller.findAll(response)).resolves.toEqual(mockResponse);
95+
const findSpy = jest
96+
.spyOn(service, "findAll")
97+
.mockResolvedValueOnce(mockResponse);
98+
await controller.findAll(response);
9699
expect(service.findAll).toHaveBeenCalled();
97100
});
98101
});

0 commit comments

Comments
 (0)