@devries-cameron20 / composio Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 03:37 UTC

next
ts 78 lines 2.66 KB
Raw
1 import { describe, expect, test } from 'bun:test';
2 import { access, readFile } from 'node:fs/promises';
3 import { join } from 'node:path';
4
5 import { getAlgoliaSearchDocuments } from '@/lib/search-index';
6
7 const DOCS_DIR = join(import.meta.dir, '../..');
8 const CONNECT_PAGE = join(DOCS_DIR, 'content/docs/composio-connect.mdx');
9 const VIDEO_TAG = /<Video\b[^>]*\/>/g;
10 const VIDEO_SRC = /\bsrc="([^"]+)"/;
11 const VIDEO_POSTER = /\bposter="([^"]+)"/;
12
13 const PINNED_CLIENT_TERMS = [
14 'Claude Code',
15 'Claude Cowork',
16 'Claude Desktop',
17 'ChatGPT',
18 'OpenClaw',
19 'Hermes',
20 'Cursor',
21 'Notion',
22 'Codex',
23 'Warp',
24 'Grok',
25 'Gemini CLI',
26 'VS Code',
27 'Devin Desktop',
28 'Windsurf',
29 'Antigravity',
30 'OpenAI Agent Builder',
31 'Agent Builder',
32 'n8n',
33 'Generic MCP URL',
34 ];
35
36 describe('Composio For You client snapshot', () => {
37 test('makes every pinned client and alias searchable from Composio Connect', async () => {
38 const records = await getAlgoliaSearchDocuments();
39 const pageRecords = records.filter(record => record.canonical_url === '/docs/composio-connect');
40 const searchableContent = pageRecords
41 .map(record => [record.title, record.description, record.content].filter(Boolean).join('\n'))
42 .join('\n');
43
44 expect(pageRecords.length).toBeGreaterThan(0);
45 for (const term of PINNED_CLIENT_TERMS) {
46 expect(searchableContent).toContain(term);
47 }
48 });
49
50 test('contains no copied credentials, dashboard links, or account identifiers', async () => {
51 const source = await readFile(CONNECT_PAGE, 'utf8');
52
53 expect(source).not.toMatch(/\b(?:ck|ak)_[A-Za-z0-9_-]+/);
54 expect(source).not.toMatch(/\b(?:org|organization|session)_[A-Za-z0-9_-]+/i);
55 expect(source).not.toMatch(/https?:\/\/(?:[a-z0-9-]+\.)?dashboard\.composio\.dev\b/i);
56 expect(source).not.toMatch(
57 /\/(?:organization|org|session)s?\/(?:[A-Za-z0-9_-]{8,}|[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})(?:[/?#]|$)/i,
58 );
59 });
60
61 test('ships every optional onboarding video and poster referenced by the page', async () => {
62 const source = await readFile(CONNECT_PAGE, 'utf8');
63 const videoTags = [...source.matchAll(VIDEO_TAG)].map(match => match[0]);
64
65 expect(videoTags).toHaveLength(7);
66 const mediaPaths = videoTags.flatMap(tag => {
67 const src = tag.match(VIDEO_SRC)?.[1];
68 const poster = tag.match(VIDEO_POSTER)?.[1];
69
70 expect(src).toMatch(/^\/videos\/.+\.mp4$/);
71 expect(poster).toMatch(/^\/videos\/.+-poster\.jpg$/);
72 return [src, poster].filter((path): path is string => Boolean(path));
73 });
74
75 expect(mediaPaths).toHaveLength(14);
76 await Promise.all(mediaPaths.map(path => access(join(DOCS_DIR, 'public', path.slice(1)))));
77 });
78 });