fix: Parse Server option extendSessionOnUse not working for session lengths < 24 hours (#9113)

This commit is contained in:
Vivek Joshi
2024-05-27 20:03:11 +05:30
committed by GitHub
parent d8ebdb3632
commit 0a054e6b54
5 changed files with 38 additions and 7 deletions

View File

@@ -260,3 +260,24 @@ describe('Auth', () => {
});
});
});
describe('extendSessionOnUse', () => {
it(`shouldUpdateSessionExpiry()`, async () => {
const { shouldUpdateSessionExpiry } = require('../lib/Auth');
let update = new Date(Date.now() - 86410 * 1000);
const res = shouldUpdateSessionExpiry(
{ sessionLength: 86460 },
{ updatedAt: update }
);
update = new Date(Date.now() - 43210 * 1000);
const res2 = shouldUpdateSessionExpiry(
{ sessionLength: 86460 },
{ updatedAt: update }
);
expect(res).toBe(true);
expect(res2).toBe(false);
});
});