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

Function assertParity

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

Source from the content-addressed store, hash-verified

75 });
76
77 function assertParity(filePath: string, source: string, minNodes = 3): void {
78 process.env.CODEGRAPH_KERNEL_LANGS = 'all';
79 delete process.env.CODEGRAPH_KERNEL;
80 const viaKernel = tryKernelExtract(filePath, source, 'ruby');
81 expect(viaKernel, `kernel extraction failed for ${filePath}`).not.toBeNull();
82
83 process.env.CODEGRAPH_KERNEL = '0';
84 const viaWasm = extractFromSource(filePath, source, 'ruby');
85 delete process.env.CODEGRAPH_KERNEL;
86
87 const k = canon(viaKernel!);
88 const w = canon(viaWasm);
89 expect(k.nodes, `${filePath}: nodes`).toEqual(w.nodes);
90 expect(k.edges, `${filePath}: edges`).toEqual(w.edges);
91 expect(k.refs, `${filePath}: refs`).toEqual(w.refs);
92 expect(viaWasm.nodes.length).toBeGreaterThanOrEqual(minNodes);
93 }
94
95 it('torture fixture: modules/mixins, visibility scan, requires, call zoo, value refs', () => {
96 const file = path.join(FIXTURE_DIR, 'torture.rb');

Callers 1

Calls 3

tryKernelExtractFunction · 0.90
extractFromSourceFunction · 0.90
canonFunction · 0.70

Tested by

no test coverage detected