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 59 lines 1.58 KB
Raw
1 /**
2 * Tool Router session.toolkits() cursor pagination E2E test.
3 *
4 * Regression test for PLEN-1886: the SDK was silently dropping the `cursor`
5 * input, so every call returned page 1. This test fails fast if that
6 * behavior ever regresses.
7 *
8 * Project-agnostic: relies on the global toolkit catalog (hundreds of
9 * toolkits), so `limit: 2` always yields multiple pages regardless of
10 * which Composio project is on CI.
11 *
12 * Requires COMPOSIO_API_KEY in environment.
13 */
14
15 import { e2e, type E2ETestResult } from '@e2e-tests/utils';
16 import { describe, it, expect, beforeAll } from 'bun:test';
17
18 declare module 'bun' {
19 interface Env {
20 COMPOSIO_API_KEY: string;
21 }
22 }
23
24 e2e(import.meta.url, {
25 versions: { node: ['22.23.5', '24.22.3', '26.13.1'] },
26 usesFixtures: true,
27 env: {
28 COMPOSIO_API_KEY: Bun.env.COMPOSIO_API_KEY,
29 },
30 defineTests: ({ runFixture }) => {
31 let result: E2ETestResult;
32
33 beforeAll(async () => {
34 result = await runFixture({ filename: 'index.mjs' });
35 }, 120_000);
36
37 describe('session.toolkits pagination', () => {
38 it('exits successfully', () => {
39 expect(result.exitCode).toBe(0);
40 });
41
42 it('page 1 returns items and a cursor', () => {
43 expect(result.stdout).toContain('PAGE1_OK');
44 });
45
46 it('page 2 returns items', () => {
47 expect(result.stdout).toContain('PAGE2_OK');
48 });
49
50 it('pagination advances past page 1', () => {
51 expect(result.stdout).toContain('ADVANCED_OK');
52 });
53
54 it('all operations complete', () => {
55 expect(result.stdout).toContain('ALL_OK');
56 });
57 });
58 },
59 });