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

Function assertParity

__tests__/kernel-kotlin-parity.test.ts:84–100  ·  view source on GitHub ↗
(filePath: string, source: string, minNodes = 3)

Source from the content-addressed store, hash-verified

82 });
83
84 function assertParity(filePath: string, source: string, minNodes = 3): void {
85 process.env.CODEGRAPH_KERNEL_LANGS = 'all';
86 delete process.env.CODEGRAPH_KERNEL;
87 const viaKernel = tryKernelExtract(filePath, source, 'kotlin');
88 expect(viaKernel, `kernel extraction failed for ${filePath}`).not.toBeNull();
89
90 process.env.CODEGRAPH_KERNEL = '0';
91 const viaWasm = extractFromSource(filePath, source, 'kotlin');
92 delete process.env.CODEGRAPH_KERNEL;
93
94 const k = canon(viaKernel!);
95 const w = canon(viaWasm);
96 expect(k.nodes, `${filePath}: nodes`).toEqual(w.nodes);
97 expect(k.edges, `${filePath}: edges`).toEqual(w.edges);
98 expect(k.refs, `${filePath}: refs`).toEqual(w.refs);
99 expect(viaWasm.nodes.length).toBeGreaterThanOrEqual(minNodes);
100 }
101
102 const FIXTURES: Array<{ file: string; minNodes: number }> = [
103 { file: 'torture.kt', minNodes: 40 },

Callers 1

Calls 3

tryKernelExtractFunction · 0.90
extractFromSourceFunction · 0.90
canonFunction · 0.70

Tested by

no test coverage detected