@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, 04:45 UTC

next
ts 62 lines 1.67 KB
Raw
1 /**
2 * Tool Router session.update() E2E test.
3 *
4 * Regression test for @composio/core 0.20.0, where update() sent
5 * `expected_config_version` by default and the live API rejected every call
6 * with a 400. Unit tests mock the transport and cannot catch a payload the API
7 * refuses, so this test sends a default update to the real API.
8 *
9 * Project-agnostic: creates its own session and deletes it afterwards.
10 *
11 * Requires COMPOSIO_API_KEY in environment.
12 */
13
14 import { e2e, type E2ETestResult } from '@e2e-tests/utils';
15 import { describe, it, expect, beforeAll } from 'bun:test';
16
17 declare module 'bun' {
18 interface Env {
19 COMPOSIO_API_KEY: string;
20 }
21 }
22
23 e2e(import.meta.url, {
24 versions: { node: ['current'] },
25 usesFixtures: true,
26 env: {
27 COMPOSIO_API_KEY: Bun.env.COMPOSIO_API_KEY,
28 },
29 defineTests: ({ runFixture }) => {
30 let result: E2ETestResult;
31
32 beforeAll(async () => {
33 result = await runFixture({ filename: 'index.mjs' });
34 }, 120_000);
35
36 describe('session.update with default options', () => {
37 it('exits successfully', () => {
38 expect(result.exitCode).toBe(0);
39 });
40
41 it('creates a session', () => {
42 expect(result.stdout).toContain('CREATE_OK');
43 });
44
45 it('applies the update and advances configVersion', () => {
46 expect(result.stdout).toContain('UPDATE_OK');
47 });
48
49 it('persists the update on the server', () => {
50 expect(result.stdout).toContain('PERSISTED_OK');
51 });
52
53 it('deletes the session', () => {
54 expect(result.stdout).toContain('DELETE_OK');
55 });
56
57 it('all operations complete', () => {
58 expect(result.stdout).toContain('ALL_OK');
59 });
60 });
61 },
62 });