14 lines
717 B
JavaScript
14 lines
717 B
JavaScript
|
|
import assert from 'node:assert/strict';
|
||
|
|
import test from 'node:test';
|
||
|
|
import { createPageDataSessionStore } from './page-data-session-store.mjs';
|
||
|
|
|
||
|
|
test('session store revokeByPageId and listByPageId work per page', () => {
|
||
|
|
const store = createPageDataSessionStore({ ttlMs: 60_000 });
|
||
|
|
const a = store.issue({ pageId: 'page-a', ownerUserId: 'owner-1', publicationId: 'pub-a', accessMode: 'password' });
|
||
|
|
const b = store.issue({ pageId: 'page-b', ownerUserId: 'owner-1', publicationId: 'pub-b', accessMode: 'password' });
|
||
|
|
assert.equal(store.listByPageId('page-a').length, 1);
|
||
|
|
assert.equal(store.revokeByPageId('page-a'), 1);
|
||
|
|
assert.equal(store.verify(a.token), null);
|
||
|
|
assert.ok(store.verify(b.token));
|
||
|
|
});
|