| 568 | } |
| 569 | |
| 570 | function makeContext(opts: { |
| 571 | files?: Record<string, string>; |
| 572 | nodes?: Node[]; |
| 573 | }) { |
| 574 | const files = opts.files ?? {}; |
| 575 | const all = opts.nodes ?? []; |
| 576 | return { |
| 577 | getNodesInFile: (fp: string) => all.filter((n) => n.filePath === fp), |
| 578 | getNodesByName: (name: string) => all.filter((n) => n.name === name), |
| 579 | getNodesByQualifiedName: () => [], |
| 580 | getNodesByKind: (kind: Node['kind']) => all.filter((n) => n.kind === kind), |
| 581 | fileExists: (fp: string) => files[fp] !== undefined, |
| 582 | readFile: (fp: string) => files[fp] ?? null, |
| 583 | getProjectRoot: () => '/test', |
| 584 | getAllFiles: () => Object.keys(files), |
| 585 | getNodesByLowerName: () => [], |
| 586 | getImportMappings: () => [], |
| 587 | } as any; |
| 588 | } |
| 589 | |
| 590 | it('prepends RouterModule prefix to a controller route (top-level register)', () => { |
| 591 | const ctx = makeContext({ |