Every edge, by its ends' natural keys, with where it is written and how it resolved.
(graph: CodeGraph)
| 182 | |
| 183 | /** Every edge, by its ends' natural keys, with where it is written and how it resolved. */ |
| 184 | function edgesOf(graph: CodeGraph): string[] { |
| 185 | const keys = new Map( |
| 186 | graph.getFiles() |
| 187 | .flatMap((file) => graph.getNodesInFile(file.path)) |
| 188 | .map((n) => [n.id, `${n.kind} ${n.filePath}:${n.qualifiedName}:${n.startLine}`] as const) |
| 189 | ); |
| 190 | return graph.getOutgoingEdgesFrom([...keys.keys()]) |
| 191 | .map((e) => `${e.kind} ${keys.get(e.source)} -> ${keys.get(e.target) ?? e.target} @${e.line}:${e.column} ${JSON.stringify(e.metadata ?? {})}`) |
| 192 | .sort(); |
| 193 | } |
| 194 | |
| 195 | /** The links of `expected`'s reference names the graph has ({@link LINKS} by default). */ |
| 196 | function linksOf(graph: CodeGraph, expected: string[] = LINKS): string[] { |
no test coverage detected