@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 37 lines 1.19 KB
Raw
1 import { expect, test } from 'vitest';
2
3 import { moduleExportFrom, namedExport } from './ExportFrom';
4 import { stringify } from './stringify';
5
6 test('module name only', () => {
7 expect(stringify(moduleExportFrom('someModule'))).toMatchInlineSnapshot(
8 `"export * from "someModule""`
9 );
10 });
11
12 test('namespace', () => {
13 const exportDecl = moduleExportFrom('myModule').asNamespace('ns');
14 expect(stringify(exportDecl)).toMatchInlineSnapshot(`"export * as ns from 'myModule'"`);
15 });
16
17 test('named', () => {
18 const exportDecl = moduleExportFrom('myModule').named('func');
19 expect(stringify(exportDecl)).toMatchInlineSnapshot(`"export { func } from "myModule""`);
20 });
21
22 test('named with alias', () => {
23 const exportDecl = moduleExportFrom('myModule').named(namedExport('func').as('myFunc'));
24 expect(stringify(exportDecl)).toMatchInlineSnapshot(
25 `"export { func as myFunc } from "myModule""`
26 );
27 });
28
29 test('multiple named', () => {
30 const exportDecl = moduleExportFrom('myModule')
31 .named('func1')
32 .named('func2')
33 .named(namedExport('func3').as('aliasedFunc3'));
34 expect(stringify(exportDecl)).toMatchInlineSnapshot(
35 `"export { func1, func2, func3 as aliasedFunc3 } from "myModule""`
36 );
37 });