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
| 1 | import { describe, expect, layer } from '@effect/vitest'; |
| 2 | import { ConfigProvider, Effect } from 'effect'; |
| 3 | import * as tempy from 'tempy'; |
| 4 | import { runArtifactsCwd } from 'src/commands/artifacts/cwd/artifacts.cwd.handler'; |
| 5 | import { TerminalUI } from 'src/services/terminal-ui'; |
| 6 | import { TestLive } from 'test/__utils__'; |
| 7 | import { terminalUITestImpl } from 'test/__utils__/services/terminal-ui-test'; |
| 8 | |
| 9 | const sessionRoot = tempy.temporaryDirectory(); |
| 10 | const outputs: Array<{ readonly data: string; readonly force: boolean | undefined }> = []; |
| 11 | |
| 12 | describe('runArtifactsCwd', () => { |
| 13 | layer( |
| 14 | TestLive({ |
| 15 | baseConfigProvider: ConfigProvider.fromEnvRecord({ COMPOSIO_SESSION_DIR: sessionRoot }), |
| 16 | terminalUI: TerminalUI.of({ |
| 17 | ...terminalUITestImpl, |
| 18 | output: (data, options) => |
| 19 | Effect.sync(() => { |
| 20 | outputs.push({ data, force: options?.force }); |
| 21 | }), |
| 22 | }), |
| 23 | }) |
| 24 | )(it => { |
| 25 | it.effect('[Then] forces the directory onto stdout even when it is a terminal', () => |
| 26 | Effect.gen(function* () { |
| 27 | yield* runArtifactsCwd(); |
| 28 | |
| 29 | expect(outputs).toEqual([{ data: sessionRoot, force: true }]); |
| 30 | }) |
| 31 | ); |
| 32 | }); |
| 33 | }); |