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

Function assertParity

__tests__/kernel-tsjs-parity.test.ts:79–96  ·  view source on GitHub ↗
(filePath: string, source: string, language: Language)

Source from the content-addressed store, hash-verified

77 });
78
79 function assertParity(filePath: string, source: string, language: Language): void {
80 process.env.CODEGRAPH_KERNEL_LANGS = 'all';
81 delete process.env.CODEGRAPH_KERNEL;
82 const viaKernel = tryKernelExtract(filePath, source, language);
83 expect(viaKernel, `kernel extraction failed for ${filePath}`).not.toBeNull();
84
85 process.env.CODEGRAPH_KERNEL = '0';
86 const viaWasm = extractFromSource(filePath, source, language);
87 delete process.env.CODEGRAPH_KERNEL;
88
89 const k = canon(viaKernel!);
90 const w = canon(viaWasm);
91 expect(k.nodes, `${filePath}: nodes`).toEqual(w.nodes);
92 expect(k.edges, `${filePath}: edges`).toEqual(w.edges);
93 expect(k.refs, `${filePath}: refs`).toEqual(w.refs);
94 // Meaningful comparison, not empty-vs-empty.
95 expect(viaWasm.nodes.length).toBeGreaterThan(3);
96 }
97
98 it('torture fixture (tsx): components, stores, RTK, fn-refs, value-refs, decorators', () => {
99 const file = path.join(FIXTURE_DIR, 'torture.tsx');

Callers 1

Calls 3

tryKernelExtractFunction · 0.90
extractFromSourceFunction · 0.90
canonFunction · 0.70

Tested by

no test coverage detected