MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / callsFrom

Function callsFrom

__tests__/js-function-local-binding.test.ts:242–249  ·  view source on GitHub ↗
(file: string, name: string, kind = 'calls')

Source from the content-addressed store, hash-verified

240
241 /** `<file>:<qualified name>` of every call (or edge of `kind`) the named symbol in `file` makes. */
242 const callsFrom = (file: string, name: string, kind = 'calls'): string[] => {
243 const node = ts.getNodesInFile(file).find((n) => n.name === name && n.kind !== 'file')!;
244 expect(node, `${file} ${name}`).toBeDefined();
245 return ts.getOutgoingEdges(node.id).filter((e) => e.kind === kind).map((e) => {
246 const target = ts.getNode(e.target)!;
247 return `${target.filePath}:${target.qualifiedName}`;
248 });
249 };
250
251 it('a parameter typed as a function, or defaulted to one, calls what it is given', () => {
252 expect(callsFrom('src/use.ts', 'pick')).toEqual([]);

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected