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

Function snapshot

__tests__/sync.test.ts:1093–1103  ·  view source on GitHub ↗
(g: CodeGraph)

Source from the content-addressed store, hash-verified

1091 let cg: CodeGraph;
1092
1093 const snapshot = (g: CodeGraph): string => {
1094 // Natural-key snapshot of the whole graph, mirroring dump-graph.mjs at
1095 // unit scale: scoped and full sync must land the DB in the same state.
1096 const nodes = g
1097 .searchNodes('', { limit: 100000 })
1098 .map((r) => r.node)
1099 .map((n) => `${n.kind}|${n.qualifiedName}|${n.filePath}|${n.startLine}`)
1100 .sort()
1101 .join('\n');
1102 return nodes;
1103 };
1104
1105 beforeEach(async () => {
1106 testDir = fs.mkdtempSync(path.join(os.tmpdir(), 'codegraph-sync-scoped-'));

Callers 1

sync.test.tsFile · 0.70

Calls 3

mapMethod · 0.80
searchNodesMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected