feat: initialize sunrise with 100-player shared rooms
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { MemoryVisitStore, type VisitRecord } from '../server/visits.ts';
|
||||
|
||||
test('closed visits cannot be resurrected by heartbeat; unfinished departure remains unknown', async () => {
|
||||
const store = new MemoryVisitStore();
|
||||
const record: VisitRecord = { _id: 'session', visitorId: 'anonymous', nickname: 'Visitor', locationId: 'gwanaksan', roomId: 'gwanaksan-001', joinedAt: new Date(1), lastSeenAt: new Date(1), leftAt: null, endReason: null, serverInstanceId: 'old' };
|
||||
await store.insert(record); await store.heartbeat(['session'], new Date(2));
|
||||
await store.finish('session', new Date(3), 'disconnect');
|
||||
await store.heartbeat(['session'], new Date(4));
|
||||
assert.equal(+store.records.get('session')!.lastSeenAt, 3);
|
||||
await store.insert({ ...record, _id: 'stale' });
|
||||
assert.equal(store.records.get('stale')!.endReason, null);
|
||||
assert.equal(store.records.get('stale')!.leftAt, null);
|
||||
assert.equal(+store.records.get('stale')!.lastSeenAt, 1);
|
||||
});
|
||||
Reference in New Issue
Block a user