mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 17:06:16 -04:00
SessionStore: Improve cookie expiration check
* Don't mutate `sess.cookie.expires`. * Allow `sess.cookie` to be nullish. * Always compare `Date` objects.
This commit is contained in:
parent
928c598ecf
commit
4d498725c7
2 changed files with 5 additions and 9 deletions
|
@ -36,7 +36,7 @@ describe(__filename, function () {
|
|||
});
|
||||
|
||||
it('set of non-expiring session', async function () {
|
||||
const sess = {foo: 'bar', baz: {asdf: 'jkl;'}, cookie: {}};
|
||||
const sess = {foo: 'bar', baz: {asdf: 'jkl;'}};
|
||||
await set(sess);
|
||||
assert.equal(JSON.stringify(await db.get(`sessionstorage:${sid}`)), JSON.stringify(sess));
|
||||
});
|
||||
|
@ -54,13 +54,13 @@ describe(__filename, function () {
|
|||
});
|
||||
|
||||
it('set+get round trip', async function () {
|
||||
const sess = {foo: 'bar', baz: {asdf: 'jkl;'}, cookie: {}};
|
||||
const sess = {foo: 'bar', baz: {asdf: 'jkl;'}};
|
||||
await set(sess);
|
||||
assert.equal(JSON.stringify(await get()), JSON.stringify(sess));
|
||||
});
|
||||
|
||||
it('get of record from previous run (no expiration)', async function () {
|
||||
const sess = {foo: 'bar', baz: {asdf: 'jkl;'}, cookie: {}};
|
||||
const sess = {foo: 'bar', baz: {asdf: 'jkl;'}};
|
||||
await db.set(`sessionstorage:${sid}`, sess);
|
||||
assert.equal(JSON.stringify(await get()), JSON.stringify(sess));
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue