@devries-cameron20 / composio Mirror · read-only / commits / d62c8ad08
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, 07:15 UTC

test(cli): pin that `connections remove --yes` keeps the selector rules (#5123)

Closes #4816 This PR: - builds on https://github.com/ComposioHQ/composio/pull/5040 (merged), which already added `--yes` (`-y`) to `composio connections remove`, plus its README note, changelog entry, and the tests that `--yes`/`-y` skip the prompt on and off a terminal - adds the one guarantee from #4816 that had no test: with `--yes`, an ambiguous selector (`github`, two connections) or an unknown one (`nothing-matches`, via `-y`) removes nothing and fails with `CommandInputError` on `<account>`, which `cli-main.ts` prints on stderr with exit 1 - tests only: no source, help, docs, or changelog change, since the behavior already shipped Verified locally: `vitest run test/src/commands/connections/remove` (10 passed), CLI `typecheck:test`, `lint:effect` (0 diagnostics), oxlint and prettier on the touched file, `validate:command-tests` OK.

Alberto Schiabel committed Oct 27, 2026 at 16:37 UTC d62c8ad08310fb07e7a86a4e9e1bc25ea3778f2d
1 file changed +46
ts/packages/cli/test/src/commands/connections/remove/connections.remove.cmd.test.ts
+46
@@ -288,6 +288,52 @@ describe('CLI: composio connections remove', () => {
288 expect(process.exitCode).toBeUndefined();
289 })
290 );
291 +
292 + it.effect(
293 + '[Given] --yes and a selector that matches several connections [Then] removes nothing and fails with a usage error',
294 + () =>
295 + Effect.gen(function* () {
296 + headlessDeleteCalls.length = 0;
297 +
298 + const userContext = yield* ComposioUserContext;
299 + yield* userContext.login('test_api_key', 'org_test');
300 + const failure = yield* cli(['connections', 'remove', 'github', '--yes']).pipe(
301 + Effect.flip
302 + );
303 +
304 + // `cli-main.ts` prints the message on stderr and exits 1.
305 + expect(failure).toMatchObject({
306 + _tag: 'commands/CommandInputError',
307 + command: 'connections remove',
308 + option: '<account>',
309 + message: expect.stringContaining('Multiple connections matched "github"'),
310 + });
311 + expect(headlessDeleteCalls).toEqual([]);
312 + })
313 + );
314 +
315 + it.effect(
316 + '[Given] --yes and a selector that matches no connection [Then] removes nothing and fails with a usage error',
317 + () =>
318 + Effect.gen(function* () {
319 + headlessDeleteCalls.length = 0;
320 +
321 + const userContext = yield* ComposioUserContext;
322 + yield* userContext.login('test_api_key', 'org_test');
323 + const failure = yield* cli(['connections', 'remove', 'nothing-matches', '-y']).pipe(
324 + Effect.flip
325 + );
326 +
327 + expect(failure).toMatchObject({
328 + _tag: 'commands/CommandInputError',
329 + command: 'connections remove',
330 + option: '<account>',
331 + message:
332 + 'No connection matched "nothing-matches". Run `composio connections list` to inspect available connections.',
333 + });
334 + expect(headlessDeleteCalls).toEqual([]);
335 + })
336 + );
337 });
338
339 const interactiveYesDeleteCalls: string[] = [];