SessionStore: Don't write DB record if already expired

This commit is contained in:
Richard Hansen 2022-01-17 17:27:23 -05:00
parent 4d498725c7
commit b991948e21
2 changed files with 16 additions and 4 deletions

View file

@ -46,6 +46,13 @@ describe(__filename, function () {
await set(sess);
assert.equal(JSON.stringify(await db.get(`sessionstorage:${sid}`)), JSON.stringify(sess));
});
it('set of already expired session', async function () {
const sess = {foo: 'bar', cookie: {expires: new Date(1)}};
await set(sess);
// No record should have been created.
assert(await db.get(`sessionstorage:${sid}`) == null);
});
});
describe('get', function () {