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

Function templateEdges

__tests__/angular-router.test.ts:511–524  ·  view source on GitHub ↗
(synthesizedBy: string)

Source from the content-addressed store, hash-verified

509
510 /** `Source -> target [kind] via @ file:line` for every template edge of one mechanism. */
511 const templateEdges = (synthesizedBy: string) =>
512 cg
513 .getNodesByKind('class')
514 .flatMap((c) =>
515 cg
516 .getOutgoingEdgesFrom([c.id], ['calls', 'references'])
517 .filter((e) => (e.metadata as Record<string, unknown> | undefined)?.synthesizedBy === synthesizedBy)
518 .map((e) => {
519 const meta = e.metadata as Record<string, unknown>;
520 const target = cg.getNode(e.target)!;
521 return `${c.name} -> ${target.kind} ${target.name} [${e.kind}${meta.fnRef ? ' fnRef' : ''}] ${String(meta.via)} @ ${String(meta.registeredAt)}`;
522 })
523 )
524 .sort();
525
526 it("links each binding's own-member call — and a callable it only reads — to the component, at the binding's line", () => {
527 expect(templateEdges('angular-binding')).toEqual([

Callers 1

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesByKindMethod · 0.65
getOutgoingEdgesFromMethod · 0.45

Tested by

no test coverage detected