@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, 03:37 UTC

next
ts 31 lines 1.29 KB
Raw
1 import { describe, expect, test } from 'bun:test';
2 import { checkLinkedExamples } from '../ts/scripts/check-cli-skills';
3
4 const linked = (code: string) => `\`\`\`ts no-check repo-file=example.ts\n${code}\n\`\`\``;
5
6 describe('repo-linked skill examples', () => {
7 test('accepts a current excerpt with different indentation', () => {
8 expect(
9 checkLinkedExamples(linked(' current();'), () => 'function example() {\ncurrent();\n}')
10 ).toBe(1);
11 });
12 test('rejects the old registration recipe even when its framework types still compile', () => {
13 expect(() =>
14 checkLinkedExamples(
15 linked('Command.withSubcommands(children)'),
16 () => 'withRegisteredSubcommands(children)'
17 )
18 ).toThrow('Example differs from example.ts');
19 });
20 test('fails when linked examples disappear', () => {
21 expect(() => checkLinkedExamples('# No examples', () => '')).toThrow('Expected at least one');
22 });
23 test('rejects an empty example instead of certifying nothing', () => {
24 expect(() => checkLinkedExamples(linked(''), () => 'source')).toThrow('Empty example');
25 });
26 test('rejects paths outside the repository', () => {
27 expect(() =>
28 checkLinkedExamples(linked('example').replace('example.ts', '../private.ts'), () => '')
29 ).toThrow('Invalid example source path');
30 });
31 });