fix(core): Fix browser session refreshes not working (#9212)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Danny Martini
2024-04-24 18:28:19 +02:00
committed by GitHub
parent 306b68da6b
commit 1efeeccc5b
2 changed files with 8 additions and 1 deletions

View File

@@ -202,6 +202,13 @@ describe('AuthService', () => {
sameSite: 'lax',
secure: false,
});
const newToken = res.cookie.mock.calls[0].at(1);
expect(newToken).not.toBe(validToken);
expect(await authService.resolveJwt(newToken, req, res)).toEqual(user);
expect((jwt.decode(newToken) as jwt.JwtPayload).browserId).toEqual(
(jwt.decode(validToken) as jwt.JwtPayload).browserId,
);
});
it('should refresh the cookie only if less than 1/4th of time is left', async () => {