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

Function assertParity

__tests__/kernel-dart-parity.test.ts:86–103  ·  view source on GitHub ↗
(filePath: string, source: string, minNodes = 2)

Source from the content-addressed store, hash-verified

84 });
85
86 function assertParity(filePath: string, source: string, minNodes = 2): ExtractionResult {
87 process.env.CODEGRAPH_KERNEL_LANGS = 'all';
88 delete process.env.CODEGRAPH_KERNEL;
89 const viaKernel = tryKernelExtract(filePath, source, 'dart');
90 expect(viaKernel, `kernel extraction failed for ${filePath}`).not.toBeNull();
91
92 process.env.CODEGRAPH_KERNEL = '0';
93 const viaWasm = extractFromSource(filePath, source, 'dart');
94 delete process.env.CODEGRAPH_KERNEL;
95
96 const k = canon(viaKernel!);
97 const w = canon(viaWasm);
98 expect(k.nodes, `${filePath}: nodes`).toEqual(w.nodes);
99 expect(k.edges, `${filePath}: edges`).toEqual(w.edges);
100 expect(k.refs, `${filePath}: refs`).toEqual(w.refs);
101 expect(viaWasm.nodes.length).toBeGreaterThanOrEqual(minNodes);
102 return viaKernel!;
103 }
104
105 const FIXTURES = [
106 ['torture.dart', 30],

Callers 1

Calls 3

tryKernelExtractFunction · 0.90
extractFromSourceFunction · 0.90
canonFunction · 0.70

Tested by

no test coverage detected