diff --git a/src/commands/org/commerce/troubleshoot/deploy.ts b/src/commands/org/commerce/troubleshoot/deploy.ts index 01cbd69..9f9e4d0 100644 --- a/src/commands/org/commerce/troubleshoot/deploy.ts +++ b/src/commands/org/commerce/troubleshoot/deploy.ts @@ -189,6 +189,7 @@ export default class CommerceTroubleshootDeploy extends Command { const environment = readString(flags.environment) ?? readString(resolvedConfiguration.environment); const hostedPageId = readString(flags.pageId); const trackingId = readString(flags.trackingId); + const hostedPageName = readString(flags.pageName); if (!organizationId) { this.error('Missing organization ID. Provide --organization or set it with coveo config:set organization .'); @@ -198,6 +199,10 @@ export default class CommerceTroubleshootDeploy extends Command { this.error('Missing access token. Provide --access-token or set it with coveo config:set accessToken .'); } + if (!hostedPageName) { + this.error('Missing page name. Provide a non-empty value for --page-name.'); + } + const keyStrategy = this.resolveKeyStrategy(flags); const request: DeployTroubleshootRequest = { @@ -216,7 +221,7 @@ export default class CommerceTroubleshootDeploy extends Command { viewUrl: flags.viewUrl, }, target: { - hostedPageName: flags.pageName, + hostedPageName, organizationId, ...(hostedPageId ? {hostedPageId} : {}), ...(region ? {region} : {}), diff --git a/test/commands/org/commerce/troubleshoot/deploy.test.ts b/test/commands/org/commerce/troubleshoot/deploy.test.ts index 45ba565..27ee4bf 100644 --- a/test/commands/org/commerce/troubleshoot/deploy.test.ts +++ b/test/commands/org/commerce/troubleshoot/deploy.test.ts @@ -1,5 +1,6 @@ import { DefaultConfig, + type Configuration, } from '@coveo/cli-commons/config/config'; import {captureOutput} from '@oclif/test'; import {expect} from 'chai'; @@ -40,7 +41,7 @@ describe('org:commerce:troubleshoot:deploy', () => { environment: 'prod', organization: 'cfg-org', region: 'us', - }) as never); + }) as Configuration); commerceTroubleshootDeployTestHooks.setLoadDeployerModule(async () => ({ async deployTroubleshootConsole(request) { @@ -115,7 +116,7 @@ describe('org:commerce:troubleshoot:deploy', () => { environment: 'prod', organization: 'ignored-org', region: 'us', - }) as never); + }) as Configuration); commerceTroubleshootDeployTestHooks.setLoadDeployerModule(async () => ({ async deployTroubleshootConsole(request) {