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

Function assertParity

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

Source from the content-addressed store, hash-verified

74 });
75
76 function assertParity(filePath: string, source: string, minNodes = 3): void {
77 process.env.CODEGRAPH_KERNEL_LANGS = 'all';
78 delete process.env.CODEGRAPH_KERNEL;
79 const viaKernel = tryKernelExtract(filePath, source, 'rust');
80 expect(viaKernel, `kernel extraction failed for ${filePath}`).not.toBeNull();
81
82 process.env.CODEGRAPH_KERNEL = '0';
83 const viaWasm = extractFromSource(filePath, source, 'rust');
84 delete process.env.CODEGRAPH_KERNEL;
85
86 const k = canon(viaKernel!);
87 const w = canon(viaWasm);
88 expect(k.nodes, `${filePath}: nodes`).toEqual(w.nodes);
89 expect(k.edges, `${filePath}: edges`).toEqual(w.edges);
90 expect(k.refs, `${filePath}: refs`).toEqual(w.refs);
91 expect(viaWasm.nodes.length).toBeGreaterThanOrEqual(minNodes);
92 }
93
94 it('preserves Tauri command attributes without treating comments or strings as registrations', () => {
95 const source = `

Callers 1

Calls 3

tryKernelExtractFunction · 0.90
extractFromSourceFunction · 0.90
canonFunction · 0.70

Tested by

no test coverage detected