From d368a8a09e91433ebcf953fd86ac43ade2cdfb3c Mon Sep 17 00:00:00 2001 From: Elaine Vegeris Date: Mon, 17 Jun 2024 12:35:30 -0400 Subject: [PATCH 1/2] feat: set QA apihost --- packages/cli-test/src/cli/cli-process.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/cli-test/src/cli/cli-process.ts b/packages/cli-test/src/cli/cli-process.ts index a478105d3..5111a02ad 100644 --- a/packages/cli-test/src/cli/cli-process.ts +++ b/packages/cli-test/src/cli/cli-process.ts @@ -12,7 +12,7 @@ export interface SlackCLIGlobalOptions { */ dev?: boolean; /** - * @description Whether the command should interact with dev.slack (`--slackdev`) + * @description Whether the command should interact with qa.slack (`--apihost qa.slack.com`) */ qa?: boolean; /** @@ -87,7 +87,10 @@ export class SlackCLIProcess { let cmd = `${process.env.SLACK_CLI_PATH}`; if (this.globalOptions) { const opts = this.globalOptions; - if (opts.qa || opts.dev) { + if (opts.qa) { + cmd += ' --apihost qa.slack.com'; + } + if (opts.dev) { cmd += ' --slackdev'; } if (opts.skipUpdate || opts.skipUpdate === undefined) { From 753a4de621ab928705876ad946158ddd671f382a Mon Sep 17 00:00:00 2001 From: Elaine Vegeris Date: Mon, 17 Jun 2024 12:46:26 -0400 Subject: [PATCH 2/2] Update test --- packages/cli-test/src/cli/cli-process.spec.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/cli-test/src/cli/cli-process.spec.ts b/packages/cli-test/src/cli/cli-process.spec.ts index c96803e78..d55db6be1 100644 --- a/packages/cli-test/src/cli/cli-process.spec.ts +++ b/packages/cli-test/src/cli/cli-process.spec.ts @@ -28,8 +28,8 @@ describe('SlackCLIProcess class', () => { describe('CLI flag handling', () => { describe('global options', () => { - it('should map qa or dev options to --slackdev', async () => { - let cmd = new SlackCLIProcess('help', { qa: true }); + it('should map dev option to --slackdev', async () => { + let cmd = new SlackCLIProcess('help', { dev: true }); await cmd.execAsync(); sandbox.assert.calledWithMatch(spawnProcessSpy, '--slackdev'); spawnProcessSpy.resetHistory(); @@ -37,9 +37,16 @@ describe('SlackCLIProcess class', () => { await cmd.execAsync(); sandbox.assert.neverCalledWithMatch(spawnProcessSpy, '--slackdev'); spawnProcessSpy.resetHistory(); - cmd = new SlackCLIProcess('help', { dev: true }); + }); + it('should map qa option to QA host', async () => { + let cmd = new SlackCLIProcess('help', { qa: true }); await cmd.execAsync(); - sandbox.assert.calledWithMatch(spawnProcessSpy, '--slackdev'); + sandbox.assert.calledWithMatch(spawnProcessSpy, '--apihost qa.slack.com'); + spawnProcessSpy.resetHistory(); + cmd = new SlackCLIProcess('help'); + await cmd.execAsync(); + sandbox.assert.neverCalledWithMatch(spawnProcessSpy, '--apihost qa.slack.com'); + spawnProcessSpy.resetHistory(); }); it('should default to passing --skip-update but allow overriding that', async () => { let cmd = new SlackCLIProcess('help');