(file: string, name: string)
| 191 | |
| 192 | /** `file:name` of each project function `name` in `file` calls, sorted. */ |
| 193 | const callsFrom = (file: string, name: string): string[] => { |
| 194 | const from = cg!.getNodesInFile(file).filter((n) => n.name === name && (n.kind === 'function' || n.kind === 'method')); |
| 195 | expect(from, `${name} in ${file}`).toHaveLength(1); |
| 196 | return cg!.getOutgoingEdgesFrom([from[0]!.id]) |
| 197 | .filter((e) => e.kind === 'calls') |
| 198 | .map((e) => cg!.getNode(e.target)!) |
| 199 | .filter((t) => t.filePath.startsWith('src/')) |
| 200 | .map((t) => `${t.filePath}:${t.name}`) |
| 201 | .sort(); |
| 202 | }; |
| 203 | |
| 204 | it('a call where nothing nearer binds the name reaches the module', () => { |
| 205 | expect(callsFrom('tests/shadow.py', 'real')).toEqual(['src/pkg/other.py:persist', 'src/pkg/other.py:update']); |
no test coverage detected