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

Function assertParity

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 3

tryKernelExtractFunction · 0.90
extractFromSourceFunction · 0.90
canonFunction · 0.70

Tested by

no test coverage detected