| 748 | } |
| 749 | |
| 750 | function makeContext(opts: { |
| 751 | files?: Record<string, string>; |
| 752 | nodes?: Node[]; |
| 753 | }) { |
| 754 | const files = opts.files ?? {}; |
| 755 | const all = opts.nodes ?? []; |
| 756 | return { |
| 757 | getNodesInFile: (fp: string) => all.filter((n) => n.filePath === fp), |
| 758 | getNodesByName: (name: string) => all.filter((n) => n.name === name), |
| 759 | getNodesByQualifiedName: () => [], |
| 760 | getNodesByKind: (kind: Node['kind']) => all.filter((n) => n.kind === kind), |
| 761 | fileExists: (fp: string) => files[fp] !== undefined, |
| 762 | readFile: (fp: string) => files[fp] ?? null, |
| 763 | getProjectRoot: () => '/test', |
| 764 | getAllFiles: () => Object.keys(files), |
| 765 | getNodesByLowerName: () => [], |
| 766 | getImportMappings: () => [], |
| 767 | } as any; |
| 768 | } |
| 769 | |
| 770 | it('prepends RouterModule prefix to a controller route (top-level register)', () => { |
| 771 | const ctx = makeContext({ |