Skip to content

Commit

Permalink
fix: ACNA-1817 - error when trying to deploy an app created with `aio…
Browse files Browse the repository at this point in the history
… app init --no-login` (#588)
  • Loading branch information
shazron authored Oct 3, 2022
1 parent 1828633 commit 6d5c29d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/commands/app/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Deploy extends BuildCommand {
}

// 2. Bail if workspace is production and application status is PUBLISHED, honor force-deploy
if (aioConfig.project.workspace.name === 'Production' && !flags['force-deploy']) {
if (aioConfig?.project?.workspace?.name === 'Production' && !flags['force-deploy']) {
const extension = await this.getApplicationExtension(libConsoleCLI, aioConfig)
spinner.info(chalk.dim(JSON.stringify(extension)))
if (extension && extension.status === 'PUBLISHED') {
Expand Down
20 changes: 20 additions & 0 deletions test/commands/app/deploy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,26 @@ describe('run', () => {
expect(command.error).toHaveBeenCalledWith(expect.stringMatching(/Nothing to be done/))
})

test('deploy for standalone app --no-publish (no login)', async () => {
command.getAppExtConfigs.mockReturnValueOnce(createAppConfig(command.appConfig, 'exc'))
mockGetExtensionPointsPublishedApp()
mockGetProject()
command.getFullConfig.mockReturnValue({
aio: {
}
})
mockExtRegExcShellPayload()
command.argv = ['--no-publish']
await command.run()

expect(mockLibConsoleCLI.getProject).toHaveBeenCalledTimes(0)
expect(mockLibConsoleCLI.getApplicationExtensions).toHaveBeenCalledTimes(0)
expect(mockWebLib.deployWeb).toHaveBeenCalledTimes(1)
expect(mockRuntimeLib.deployActions).toHaveBeenCalledTimes(1)
expect(mockLibConsoleCLI.updateExtensionPoints).toHaveBeenCalledTimes(0)
expect(mockLibConsoleCLI.updateExtensionPointsWithoutOverwrites).toHaveBeenCalledTimes(0)
})

test('deploy for PUBLISHED Production extension - no publish', async () => {
command.getAppExtConfigs.mockReturnValueOnce(createAppConfig(command.appConfig, 'exc'))
mockGetExtensionPointsPublishedApp()
Expand Down

0 comments on commit 6d5c29d

Please sign in to comment.