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 { describe, expect, it } from 'vitest'; |
| 2 | import { Record } from 'effect'; |
| 3 | import { |
| 4 | COMMAND_HINTS, |
| 5 | commandHintExample, |
| 6 | commandHintLinks, |
| 7 | renderCommandHintGraph, |
| 8 | } from 'src/services/command-hints'; |
| 9 | |
| 10 | describe('command-hints', () => { |
| 11 | it('has no dangling linked command ids', () => { |
| 12 | const ids = Record.keys(COMMAND_HINTS); |
| 13 | const linkedIds = ids.flatMap(id => commandHintLinks(id)); |
| 14 | |
| 15 | expect(linkedIds.length).toBeGreaterThan(0); |
| 16 | expect(ids).toEqual(expect.arrayContaining(linkedIds)); |
| 17 | }); |
| 18 | |
| 19 | it('renders examples from the registry', () => { |
| 20 | expect(commandHintExample('root.tools.list')).toContain('composio tools list'); |
| 21 | expect(commandHintExample('root.triggers.list')).toContain('composio triggers list'); |
| 22 | expect(commandHintExample('root.triggers.info', { slug: 'GMAIL_NEW_GMAIL_MESSAGE' })).toContain( |
| 23 | 'GMAIL_NEW_GMAIL_MESSAGE' |
| 24 | ); |
| 25 | expect(commandHintExample('root.execute', { slug: 'GMAIL_SEND_EMAIL' })).toContain( |
| 26 | 'GMAIL_SEND_EMAIL' |
| 27 | ); |
| 28 | expect(commandHintExample('root.execute.getSchema', { slug: 'GMAIL_SEND_EMAIL' })).toContain( |
| 29 | '--get-schema' |
| 30 | ); |
| 31 | expect(commandHintExample('dev.logs.tools', { logId: 'log_123' })).toContain('log_123'); |
| 32 | expect(commandHintExample('root.search')).toBe('composio search "<query>"'); |
| 33 | expect(commandHintExample('root.search', { query: 'send email' })).toBe( |
| 34 | 'composio search "send email"' |
| 35 | ); |
| 36 | expect(commandHintExample('root.search', { toolkits: 'custom_grain' })).toBe( |
| 37 | 'composio search "<query>" --toolkits custom_grain' |
| 38 | ); |
| 39 | }); |
| 40 | |
| 41 | it('serializes the graph with nodes and links', () => { |
| 42 | const graph = renderCommandHintGraph(); |
| 43 | expect(graph.nodes.length).toBeGreaterThan(0); |
| 44 | expect(graph.nodes.find(node => node.id === 'root.execute')).toMatchObject({ |
| 45 | id: 'root.execute', |
| 46 | }); |
| 47 | }); |
| 48 | }); |