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, test } from 'bun:test'; |
| 2 | import { fetchPage } from './helpers'; |
| 3 | |
| 4 | const LIVE_ONLY_TOOLKIT_SLUG = '7shifts'; |
| 5 | |
| 6 | describe('toolkit snapshot fallback', () => { |
| 7 | test('renders a toolkit from the committed snapshot', async () => { |
| 8 | const response = await fetchPage('/toolkits/github'); |
| 9 | const html = await response.text(); |
| 10 | |
| 11 | expect(response.status).toBe(200); |
| 12 | expect(response.headers.get('content-type')).toContain('text/html'); |
| 13 | expect(html.toLowerCase()).toContain('github'); |
| 14 | }); |
| 15 | |
| 16 | test('returns 404 for a nonsense toolkit slug', async () => { |
| 17 | const response = await fetchPage('/toolkits/__definitely-not-a-toolkit__'); |
| 18 | |
| 19 | expect(response.status).toBe(404); |
| 20 | }); |
| 21 | |
| 22 | if (process.env.COMPOSIO_API_KEY) { |
| 23 | test('renders fallback content and metadata for a production-only toolkit', async () => { |
| 24 | const response = await fetchPage(`/toolkits/${LIVE_ONLY_TOOLKIT_SLUG}`); |
| 25 | const html = await response.text(); |
| 26 | |
| 27 | expect(response.status).toBe(200); |
| 28 | expect(html.toLowerCase()).toContain('7shifts'); |
| 29 | expect(html).toMatch(/<title>[^<]*7shifts[^<]*Composio Toolkit[^<]*<\/title>/i); |
| 30 | expect(html).toContain(`<link rel="canonical" href="/toolkits/${LIVE_ONLY_TOOLKIT_SLUG}"`); |
| 31 | expect(html).not.toContain('<title>Toolkit Not Found'); |
| 32 | }); |
| 33 | } else { |
| 34 | test.skip('production-only fallback requires COMPOSIO_API_KEY', () => {}); |
| 35 | } |
| 36 | }); |