* ` -> :: ` for every edge * of `kind` the function `name` in `file` has to a function or method.
(file: string, name: string, kind: 'calls' | 'references' = 'calls')
| 281 | * of `kind` the function `name` in `file` has to a function or method. |
| 282 | */ |
| 283 | function links(file: string, name: string, kind: 'calls' | 'references' = 'calls'): string[] { |
| 284 | const fn = cg!.getNodesInFile(file).find((n) => n.qualifiedName === name && n.kind === 'function'); |
| 285 | expect(fn, `${name} in ${file}`).toBeDefined(); |
| 286 | const lines = FILES[file]!.split('\n'); |
| 287 | return cg! |
| 288 | .getOutgoingEdges(fn!.id) |
| 289 | .filter((e) => e.kind === kind) |
| 290 | .map((e) => ({ e, target: cg!.getNode(e.target)! })) |
| 291 | .filter(({ target }) => target.kind === 'method' || target.kind === 'function') |
| 292 | .map(({ e, target }) => `${lines[e.line! - 1]!.trim()} -> ${target.filePath}::${target.qualifiedName}`) |
| 293 | .sort(); |
| 294 | } |
| 295 | |
| 296 | it('links nothing through an asserted type from outside the project', () => { |
| 297 | // Name matching took alpha's BufFlusher::Flush, whose owner shares the |
no test coverage detected