Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | import { expect, test } from 'vitest'; |
| 2 | |
| 3 | import { genericParameter } from './GenericParameter'; |
| 4 | import { namedType } from './NamedType'; |
| 5 | import { stringify } from './stringify'; |
| 6 | |
| 7 | const A = namedType('A'); |
| 8 | const B = namedType('B'); |
| 9 | |
| 10 | test('name only', () => { |
| 11 | expect(stringify(genericParameter('T'))).toMatchInlineSnapshot(`"T"`); |
| 12 | }); |
| 13 | |
| 14 | test('with extends', () => { |
| 15 | expect(stringify(genericParameter('T').extends(A))).toMatchInlineSnapshot(`"T extends A"`); |
| 16 | }); |
| 17 | |
| 18 | test('with default', () => { |
| 19 | expect(stringify(genericParameter('T').default(B))).toMatchInlineSnapshot(`"T = B"`); |
| 20 | }); |
| 21 | |
| 22 | test('with extends + default', () => { |
| 23 | expect(stringify(genericParameter('T').extends(A).default(B))).toMatchInlineSnapshot( |
| 24 | `"T extends A = B"` |
| 25 | ); |
| 26 | }); |