Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | import { describe, expect, it } from '@effect/vitest'; |
| 2 | import { Console, Effect, Layer } from 'effect'; |
| 3 | import { |
| 4 | PROJECTS_SWITCH_UNSUPPORTED_MESSAGE, |
| 5 | runProjectsSwitch, |
| 6 | } from 'src/commands/projects/switch/projects.switch.handler'; |
| 7 | import { TerminalUI } from 'src/services/terminal-ui'; |
| 8 | import { MockConsole } from 'test/__utils__'; |
| 9 | import { terminalUITestImpl } from 'test/__utils__/services/terminal-ui-test'; |
| 10 | |
| 11 | describe('runProjectsSwitch', () => { |
| 12 | it.effect('[Then] logs the `composio dev init` pointer and outputs no data', () => { |
| 13 | const outputs: Array<string> = []; |
| 14 | const layer = Layer.mergeAll( |
| 15 | Layer.effect(Console.Console, MockConsole.make), |
| 16 | Layer.succeed( |
| 17 | TerminalUI, |
| 18 | TerminalUI.of({ |
| 19 | ...terminalUITestImpl, |
| 20 | output: data => |
| 21 | Effect.sync(() => { |
| 22 | outputs.push(data); |
| 23 | }), |
| 24 | }) |
| 25 | ) |
| 26 | ); |
| 27 | return Effect.gen(function* () { |
| 28 | yield* runProjectsSwitch(); |
| 29 | |
| 30 | expect(outputs).toEqual([]); |
| 31 | expect(yield* MockConsole.getLines()).toEqual([PROJECTS_SWITCH_UNSUPPORTED_MESSAGE]); |
| 32 | }).pipe(Effect.provide(layer)); |
| 33 | }); |
| 34 | }); |