Skip to content

Commit 9b114e8

Browse files
committed
refactor: mocking 방식 변경
1 parent ab01d71 commit 9b114e8

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

nestjs-BE/server/src/refresh-tokens/refresh-tokens.service.spec.ts

+7-9
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,20 @@ describe('RefreshTokensService', () => {
7272
expiryDate: getExpiryDate({ week: 2 }),
7373
userUuid: 'userId',
7474
};
75-
jest.spyOn(prisma.refreshToken, 'delete').mockResolvedValue(testToken);
75+
(prisma.refreshToken.delete as jest.Mock).mockResolvedValue(testToken);
7676

7777
const token = service.deleteRefreshToken(testToken.token);
7878

7979
await expect(token).resolves.toEqual(testToken);
8080
});
8181

8282
it('deleteRefreshToken not found', async () => {
83-
jest
84-
.spyOn(prisma.refreshToken, 'delete')
85-
.mockRejectedValue(
86-
new PrismaClientKnownRequestError(
87-
'An operation failed because it depends on one or more records that were required but not found. Record to delete not found.',
88-
{ code: 'P2025', clientVersion: '' },
89-
),
90-
);
83+
(prisma.refreshToken.delete as jest.Mock).mockRejectedValue(
84+
new PrismaClientKnownRequestError(
85+
'An operation failed because it depends on one or more records that were required but not found. Record to delete not found.',
86+
{ code: 'P2025', clientVersion: '' },
87+
),
88+
);
9189

9290
const token = service.deleteRefreshToken('Token');
9391

0 commit comments

Comments
 (0)