Skip to content

Commit ad3f2d3

Browse files
author
hersveit
committed
sign-out test
1 parent aed8ad4 commit ad3f2d3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

apps/api/src/modules/auth/__tests__/auth.service.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,15 @@ describe('AuthService', () => {
176176
expect(confirmResult).toBeInstanceOf(CannotFindEmailConfirm);
177177
});
178178
});
179+
180+
describe('sign-out', () => {
181+
it('should delete refresh token from user on signOut', async () => {
182+
rep.user.findOne.mockResolvedValue(user);
183+
184+
await authService.signOut(user.id);
185+
186+
expect(rep.user.save).toHaveBeenCalledTimes(1);
187+
expect(rep.user.save).toHaveBeenCalledWith({ ...user, refreshTokenHash: null });
188+
});
189+
});
179190
});

0 commit comments

Comments
 (0)