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 24 lines 1.13 KB
Raw
1 import { describe, expect, it } from 'vitest';
2 import { dashboardConnectUrl } from 'src/commands/connected-accounts/link/connected-accounts.link.format';
3
4 // The dashboard URL is built from user-controlled segments (the org name comes from the
5 // session info, the toolkit slug from argv), so the path segments must stay encoded.
6 describe('connected-accounts link format: dashboardConnectUrl', () => {
7 it('encodes spaces in the org name and a plain toolkit slug', () => {
8 expect(dashboardConnectUrl('https://app.composio.dev', 'Acme Inc', 'gmail')).toBe(
9 'https://app.composio.dev/Acme%20Inc/~/connect/apps/gmail?open=true'
10 );
11 });
12
13 it('encodes `@` and strips the web URL’s trailing slash', () => {
14 expect(dashboardConnectUrl('https://app.composio.dev/', 'ops@example.com', 'notion')).toBe(
15 'https://app.composio.dev/ops%40example.com/~/connect/apps/notion?open=true'
16 );
17 });
18
19 it('keeps a subpath base URL and an already-plain org placeholder', () => {
20 expect(dashboardConnectUrl('https://app.composio.dev/eu', '~', 'linear')).toBe(
21 'https://app.composio.dev/eu/~/~/connect/apps/linear?open=true'
22 );
23 });
24 });