feat: initialize sunrise with 100-player shared rooms

This commit is contained in:
2026-10-30 16:36:35 +09:00
commit 31d6eac4c2
257 changed files with 66063 additions and 0 deletions
+16
View File
@@ -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);
});