()
| 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'); |
no test coverage detected