What the alias named `name` in `file` links on to: ` : `, sorted.
(cg: CodeGraph, file: string, name: string)
| 41 | |
| 42 | /** What the alias named `name` in `file` links on to: `<file>:<qualified name>`, sorted. */ |
| 43 | function aliasTargets(cg: CodeGraph, file: string, name: string): string[] { |
| 44 | const alias = cg.getNodesInFile(file).find((n) => n.name === name && (n.kind === 'constant' || n.kind === 'variable')); |
| 45 | expect(alias, `${file}: ${name}`).toBeDefined(); |
| 46 | return cg |
| 47 | .getOutgoingEdgesFrom([alias!.id]) |
| 48 | .filter((e) => (e.metadata as Record<string, unknown> | undefined)?.synthesizedBy === 'const-alias') |
| 49 | .map((e) => { |
| 50 | const t = cg.getNode(e.target); |
| 51 | return `${t?.filePath}:${t?.qualifiedName}`; |
| 52 | }) |
| 53 | .sort(); |
| 54 | } |
| 55 | |
| 56 | /** The names on the flow a query finds, in order. */ |
| 57 | function flow(cg: CodeGraph, query: string): string[] { |
no test coverage detected