Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
ts 43 lines 1.86 KB
Raw
1 import { expect, test } from 'bun:test';
2 import { source, mdxToCleanMarkdown } from '../../lib/source';
3 import { GET as getRoutingMap } from '../../app/llms.txt/route';
4
5 function providersPage() {
6 const page = source.getPage(['providers']);
7 if (!page) throw new Error('Missing providers page');
8 return page;
9 }
10
11 test('provider Markdown exposes every current guide and the adapters sharing guides', async () => {
12 const markdown = mdxToCleanMarkdown(await providersPage().data.getText('raw'));
13 const destinations = new Set(Array.from(
14 markdown.matchAll(/^- \[[^\]]+\]\((\/docs\/providers\/[^)]+)\)/gm), match => match[1],
15 ));
16 const guides = source.getPages().filter(page =>
17 page.slugs[0] === 'providers' && page.slugs.length === 2,
18 );
19 expect([...destinations].sort()).toEqual(guides.map(page => page.url).sort());
20
21 // These adapters share vendor guides and cannot be discovered from titles alone.
22 for (const [name, guide] of [
23 ['OpenAI Agents SDK', 'openai'],
24 ['Claude Agent SDK', 'anthropic'],
25 ['Google ADK', 'google'],
26 ['LangGraph', 'langchain'],
27 ]) {
28 expect(markdown).toContain(`[${name}](/docs/providers/${guide})`);
29 }
30 expect(markdown).toContain('[Anthropic](/docs/providers/anthropic) (Python, TypeScript)');
31 for (const slug of ['pi', 'eve']) {
32 expect(markdown).toContain(`](/docs/providers/${slug}) (TypeScript; experimental)`);
33 }
34 expect(markdown).not.toMatch(/ProviderList|languages=|\/>/);
35 expect(markdown).toContain('[Cloudflare Workers AI](https://github.com/ComposioHQ/composio/blob/next/ts/packages/providers/cloudflare/README.md) (TypeScript)');
36 });
37
38 test('concise discovery routes OpenAI and Anthropic readers to owned guides', async () => {
39 const text = await getRoutingMap().text();
40 for (const slug of ['openai', 'anthropic']) {
41 expect(text).toContain(`](https://docs.composio.dev/docs/providers/${slug}.md)`);
42 }
43 });