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 | /** |
| 2 | * Tool Router session files mount E2E test. |
| 3 | * |
| 4 | * Verifies list, upload, download, and delete operations against the live Composio API. |
| 5 | * Requires COMPOSIO_API_KEY in environment. |
| 6 | */ |
| 7 | |
| 8 | import { e2e, type E2ETestResult } from '@e2e-tests/utils'; |
| 9 | import { describe, it, expect, beforeAll } from 'bun:test'; |
| 10 | |
| 11 | declare module 'bun' { |
| 12 | interface Env { |
| 13 | COMPOSIO_API_KEY: string; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | e2e(import.meta.url, { |
| 18 | versions: { node: ['22.23.5', '24.22.3', '26.13.1'] }, |
| 19 | usesFixtures: true, |
| 20 | env: { |
| 21 | COMPOSIO_API_KEY: Bun.env.COMPOSIO_API_KEY, |
| 22 | }, |
| 23 | defineTests: ({ runFixture }) => { |
| 24 | let result: E2ETestResult; |
| 25 | const isStorageUnavailable = () => |
| 26 | result.stdout.includes('UPLOAD_UNAVAILABLE') || result.stdout.includes('FILES_MOUNT_UNAVAILABLE'); |
| 27 | |
| 28 | beforeAll(async () => { |
| 29 | result = await runFixture({ filename: 'index.mjs' }); |
| 30 | }, 120_000); |
| 31 | |
| 32 | describe('Tool Router session files', () => { |
| 33 | it('exits successfully', () => { |
| 34 | expect(result.exitCode).toBe(0); |
| 35 | }); |
| 36 | |
| 37 | it('upload succeeds or is explicitly unavailable', () => { |
| 38 | expect(result.stdout).toMatch(/UPLOAD_OK|UPLOAD_UNAVAILABLE|FILES_MOUNT_UNAVAILABLE/); |
| 39 | }); |
| 40 | |
| 41 | it('list succeeds', () => { |
| 42 | if (isStorageUnavailable()) { |
| 43 | expect(result.stdout).toMatch(/LIST_SKIP|storage authorization failed/); |
| 44 | return; |
| 45 | } |
| 46 | expect(result.stdout).toMatch(/LIST_OK|LIST_SKIP/); |
| 47 | }); |
| 48 | |
| 49 | it('download succeeds or is skipped after unavailable upload', () => { |
| 50 | if (isStorageUnavailable()) { |
| 51 | expect(result.stdout).toMatch(/DOWNLOAD_SKIP|storage authorization failed/); |
| 52 | return; |
| 53 | } |
| 54 | expect(result.stdout).toContain('DOWNLOAD_OK'); |
| 55 | }); |
| 56 | |
| 57 | it('delete succeeds or is skipped after unavailable upload', () => { |
| 58 | if (isStorageUnavailable()) { |
| 59 | expect(result.stdout).toMatch(/DELETE_SKIP|storage authorization failed/); |
| 60 | return; |
| 61 | } |
| 62 | expect(result.stdout).toContain('DELETE_OK'); |
| 63 | }); |
| 64 | |
| 65 | it('all operations complete or are explicitly skipped', () => { |
| 66 | if (isStorageUnavailable()) { |
| 67 | expect(result.stdout).toMatch(/ALL_SKIP|storage authorization failed/); |
| 68 | return; |
| 69 | } |
| 70 | expect(result.stdout).toContain('ALL_OK'); |
| 71 | }); |
| 72 | }); |
| 73 | }, |
| 74 | }); |