Testing
import * as mod from "jsr:@nzip/lofi-node/testing";
In-process test helpers for lofi-node consumers.
createTestMesh chains in-memory Jazz servers with direct loopback
upstream URLs — no iroh, no native addon, no network beyond 127.0.0.1 — so
app test suites can exercise multi-node sync topologies cheaply:
import { createTestMesh } from "@nzip/lofi-node/testing";
const mesh = await createTestMesh({ nodes: 2 });
// point two clients at mesh.nodes[0].url / mesh.nodes[1].url …
await mesh.stop();
createTestMesh
function
async function createTestMesh(options: TestMeshOptions): Promise<TestMesh>
Node 0 is the root; node i+1 uses node i as its direct upstream. All nodes share one appId and secrets (they model one user's fleet).
TestMesh
interface
interface TestMesh {
nodes: SyncNode[];
stop(): Promise<void>;
}
A running in-process mesh; stop() tears nodes down leaves-first.
TestMeshOptions
interface
interface TestMeshOptions {
nodes?: number;
appId?: string;
}
Options for createTestMesh.