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 31 lines 1.14 KB
Raw
1 import { describe, expect, it } from 'vitest';
2 import { normalizeRunScriptArgs } from 'src/commands/argv-compat';
3
4 const argv = (...args: ReadonlyArray<string>) => ['bun', 'composio', ...args];
5
6 describe('normalizeRunScriptArgs', () => {
7 it.each(['--unknown', '--foo_bar', '--foo_bar=value', '-foo_bar'])(
8 'leaves %s ahead of inline source for the framework to reject',
9 flag => {
10 const input = argv('run', flag, 'console.log(1)');
11
12 expect(normalizeRunScriptArgs(input)).toEqual(input);
13 }
14 );
15
16 it('still treats inline source that starts with a dash and a digit as the script', () => {
17 expect(normalizeRunScriptArgs(argv('run', '-1 + 2'))).toEqual(argv('run', '--', '-1 + 2'));
18 });
19
20 it('forwards an unknown flag after --file as a script argument', () => {
21 expect(normalizeRunScriptArgs(argv('run', '--file', 'script.ts', '--repo', 'acme'))).toEqual(
22 argv('run', '--file', 'script.ts', '--', '--repo', 'acme')
23 );
24 });
25
26 it('keeps flag-shaped inline source behind an explicit delimiter', () => {
27 const input = argv('run', '--', '--unknown');
28
29 expect(normalizeRunScriptArgs(input)).toEqual(input);
30 });
31 });