Skip to content

Commit

Permalink
Continue App init when Login timeouts (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeep-paliwal authored May 18, 2020
1 parent c8abd43 commit bcf6fd1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/commands/app/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ class InitCommand extends BaseCommand {
let services = 'AdobeTargetSDK,AdobeAnalyticsSDK,CampaignSDK,McDataServicesSdk,AudienceManagerCustomerSDK' // todo fetch those from console when no --import

if (!(flags.import || flags.yes)) {
const { accessToken, env: imsEnv } = await getCliInfo()

try {
const { accessToken, env: imsEnv } = await getCliInfo()
const generatedFile = 'console.json'
env.register(require.resolve('@adobe/generator-aio-console'), 'gen-console')
res = await env.run('gen-console', {
Expand Down
20 changes: 20 additions & 0 deletions test/commands/app/init.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,26 @@ describe('run', () => {
expect(spyChdir).not.toHaveBeenCalled()
})

test('getCliInfo error', async () => {
mockGetCli.mockReset()
mockGetCli.mockImplementationOnce(() => { throw new Error('Error') })

const project = mockValidConfig()
await TheCommand.run(['--skip-install'])

expect(yeoman.createEnv).toHaveBeenCalled()
expect(mockRegister).toHaveBeenCalledTimes(1)
const genApp = mockRegister.mock.calls[0][1]
expect(mockRun).toHaveBeenNthCalledWith(1, genApp, {
'skip-prompt': false,
'skip-install': true,
'project-name': project.name,
'adobe-services': getFullServicesList()
})
expect(fs.ensureDirSync).not.toHaveBeenCalled()
expect(spyChdir).not.toHaveBeenCalled()
})

test('no-path', async () => {
const project = mockValidConfig()
await TheCommand.run([])
Expand Down

0 comments on commit bcf6fd1

Please sign in to comment.