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

Function converges

__tests__/parameter-flow.test.ts:598–609  ·  view source on GitHub ↗

Index `first`, apply `change` to the files, sync, and compare with a fresh index of the result.

(first: Record<string, string>, change: (root: string) => void)

Source from the content-addressed store, hash-verified

596
597 /** Index `first`, apply `change` to the files, sync, and compare with a fresh index of the result. */
598 async function converges(first: Record<string, string>, change: (root: string) => void): Promise<{ synced: CodeGraph; root: string }> {
599 const { root, cg } = await indexed(first);
600 change(root);
601 await cg.sync();
602 const fresh = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-parameter-flow-fresh-'));
603 roots.push(fresh);
604 fs.cpSync(root, fresh, { recursive: true, filter: (src) => !src.includes('.codegraph') });
605 const rebuilt = await CodeGraph.init(fresh, { index: true });
606 open.push(rebuilt);
607 expect(graphOf(cg)).toEqual(graphOf(rebuilt));
608 return { synced: cg, root };
609 }
610
611 it('runs for a sync that touches the language, and no other', async () => {
612 const { root, cg } = await indexed({ ...BASE, 'lib/app.ts': 'export const a = 1;\n' });

Callers 1

Calls 6

pushMethod · 0.80
indexedFunction · 0.70
graphOfFunction · 0.70
syncMethod · 0.45
joinMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected