@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 32 lines 1.23 KB
Raw
1 import { describe, expect, it } from 'vitest';
2 import { Option } from 'effect';
3 import { consumerUserIdOf } from 'src/commands/debug/api-info/debug.api-info.handler';
4 import type { ResolvedCommandProject } from 'src/services/command-project';
5
6 const project = (overrides: Partial<ResolvedCommandProject>): ResolvedCommandProject => ({
7 orgId: 'org_1',
8 projectId: 'project_1',
9 projectType: 'CONSUMER',
10 source: 'consumer-default',
11 ...overrides,
12 });
13
14 describe('debug api-info handler: consumerUserIdOf', () => {
15 // Only a consumer project carries the playground user the API key acts for.
16 it.each([
17 { name: 'no project', input: Option.none(), expected: null },
18 {
19 name: 'a consumer project with a user',
20 input: Option.some(project({ consumerUserId: 'consumer-user-org_1' })),
21 expected: 'consumer-user-org_1',
22 },
23 { name: 'a consumer project without a user', input: Option.some(project({})), expected: null },
24 {
25 name: 'a developer project with a user',
26 input: Option.some(project({ projectType: 'DEVELOPER', consumerUserId: 'ignored' })),
27 expected: null,
28 },
29 ])('[Given] $name [Then] returns $expected', ({ input, expected }) => {
30 expect(consumerUserIdOf(input)).toBe(expected);
31 });
32 });