import test from "node:test"; import assert from "node:assert/strict"; import { makeCharacter, makeSimulation } from "./helpers/simulationHarness.js"; test("thread workers speak the same protocol as in-process workers", { timeout: 20_000 }, async () => { const harness = makeSimulation({ workerCount: 1, workerMode: "thread" }); try { const character = makeCharacter(harness.stateDb); const entityId = harness.simulation.spawnCharacter(1, character); const snapshots = harness.simulation.snapshotFor(entityId); assert.equal(snapshots.length, 9); assert.ok(snapshots.some((snapshot) => snapshot.entities.some((entity) => entity.entityId === entityId))); } finally { await harness.simulation.shutdown(); harness.worldDb.close(); harness.stateDb.close(); } });