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

Function assertStructural

__tests__/sync-rebuild-convergence.test.ts:766–782  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

764 write('worker.go', 'package demo\nfunc (w Worker) Run() {}\n');
765 await load();
766 const assertStructural = async () => {
767 const contains = readEdges().filter(e => JSON.parse(e.metadata).synthesizedBy === 'go-method-contains');
768 expect(contains).toHaveLength(1);
769 expect(contains[0].kind).toBe('contains');
770 expect.soft(contains[0].provenance).toBeNull();
771 const result = await new ToolHandler(cg).execute('codegraph_explore', { query: 'Worker Run' });
772 expect(result.isError).not.toBe(true);
773 const text = result.content.map(c => c.text ?? '').join('\n');
774 expect(text).toContain('func (w Worker) Run()');
775 expect(text).not.toMatch(/\[dynamic\b/i);
776 const { db } = createDatabase(path.join(dir, '.codegraph', 'codegraph.db'), { readOnly: true });
777 try {
778 const queries = new QueryBuilder(db);
779 expect(queries.hasSynthesizedEdgesTouchingFile('types.go')).toBe(true);
780 expect(queries.hasSynthesizedEdgesTouchingFile('worker.go')).toBe(true);
781 } finally { db.close(); }
782 };
783 await assertStructural();
784 // Refresh with both endpoints untouched, then with the method re-extracted.
785 write('unrelated.go', 'package demo\ntype Extra struct {}\n');

Calls 8

createDatabaseFunction · 0.90
readEdgesFunction · 0.85
parseMethod · 0.80
mapMethod · 0.80
closeMethod · 0.65
executeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected