MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / fakeGraph

Function fakeGraph

__tests__/project-lifecycle-valve-backoff.test.ts:25–42  ·  view source on GitHub ↗

The parts of a CodeGraph the lifecycle drives, with a sync that fails as told.

(fail: (call: number) => Error | null)

Source from the content-addressed store, hash-verified

23
24/** The parts of a CodeGraph the lifecycle drives, with a sync that fails as told. */
25function fakeGraph(fail: (call: number) => Error | null) {
26 let calls = 0;
27 const graph = {
28 get syncCalls() { return calls; },
29 watch: () => false,
30 isWatching: () => false,
31 isIndexing: () => false,
32 hasPendingIndexRecovery: () => false,
33 close: () => {},
34 sync: async () => {
35 calls++;
36 const err = fail(calls);
37 if (err) throw err;
38 return { filesAdded: 0, filesModified: 0, filesRemoved: 0, durationMs: 1 };
39 },
40 };
41 return graph;
42}
43
44const valveAbort = () => new WalValveAbortError(
45 'WAL checkpoint cannot progress while a reader pins frames (test).',

Calls 1

failFunction · 0.50

Tested by

no test coverage detected