| 1649 | // The implements back-reference comes FROM the implementing type's node |
| 1650 | // for every impl shape, named by the trait's full text. |
| 1651 | const implementsFrom = (typeName: string): string[] => { |
| 1652 | const typeNode = result.nodes.find((n) => n.name === typeName && n.kind === 'struct'); |
| 1653 | expect(typeNode, typeName).toBeDefined(); |
| 1654 | return result.unresolvedReferences |
| 1655 | .filter((r) => r.referenceKind === 'implements' && r.fromNodeId === typeNode!.id) |
| 1656 | .map((r) => r.referenceName); |
| 1657 | }; |
| 1658 | expect(implementsFrom('FileSource')).toEqual(['Source']); |
| 1659 | expect(implementsFrom('BufSource')).toEqual(['Source']); |
| 1660 | expect(implementsFrom('Parents')).toEqual(['Iterator']); |