(typeName: string, file: string)
| 1280 | cg = await CodeGraph.init(tempDir, { index: true }); |
| 1281 | |
| 1282 | const methodsOf = (typeName: string, file: string): string[] => { |
| 1283 | const node = cg |
| 1284 | .getNodesByKind('struct') |
| 1285 | .find((n) => n.name === typeName && n.filePath.replace(/\\/g, '/') === file); |
| 1286 | expect(node, `${typeName} @ ${file}`).toBeDefined(); |
| 1287 | return cg |
| 1288 | .getOutgoingEdges(node!.id) |
| 1289 | .filter((e) => e.kind === 'contains') |
| 1290 | .map((e) => cg.getNode(e.target)) |
| 1291 | .filter((n) => !!n && n.kind === 'method') |
| 1292 | .map((n) => n!.name) |
| 1293 | .sort(); |
| 1294 | }; |
| 1295 | |
| 1296 | // Cross-file (non-generic) methods now attach to their struct. |
| 1297 | expect(methodsOf('Box', 'box.go')).toEqual(['Get', 'Set']); |
no test coverage detected