(typeName: string, file: string)
| 1190 | cg = await CodeGraph.init(tempDir, { index: true }); |
| 1191 | |
| 1192 | const methodsOf = (typeName: string, file: string): string[] => { |
| 1193 | const node = cg |
| 1194 | .getNodesByKind('struct') |
| 1195 | .find((n) => n.name === typeName && n.filePath.replace(/\\/g, '/') === file); |
| 1196 | expect(node, `${typeName} @ ${file}`).toBeDefined(); |
| 1197 | return cg |
| 1198 | .getOutgoingEdges(node!.id) |
| 1199 | .filter((e) => e.kind === 'contains') |
| 1200 | .map((e) => cg.getNode(e.target)) |
| 1201 | .filter((n) => !!n && n.kind === 'method') |
| 1202 | .map((n) => n!.name) |
| 1203 | .sort(); |
| 1204 | }; |
| 1205 | |
| 1206 | // Cross-file (non-generic) methods now attach to their struct. |
| 1207 | expect(methodsOf('Box', 'box.go')).toEqual(['Get', 'Set']); |
no test coverage detected