diff --git a/lib/__tests__/personalAccessKey.ts b/lib/__tests__/personalAccessKey.ts index 3a222e64..67c6a5dc 100644 --- a/lib/__tests__/personalAccessKey.ts +++ b/lib/__tests__/personalAccessKey.ts @@ -198,8 +198,8 @@ describe('lib/personalAccessKey', () => { await updateConfigWithPersonalAccessKey( 'pak_123', - 'account-name', - ENVIRONMENTS.QA + ENVIRONMENTS.QA, + 'account-name' ); expect(updateAccountConfig).toHaveBeenCalledWith( @@ -222,8 +222,8 @@ describe('lib/personalAccessKey', () => { await updateConfigWithPersonalAccessKey( 'pak_123', - 'account-name', - ENVIRONMENTS.QA + ENVIRONMENTS.QA, + 'account-name' ); expect(updateAccountConfig).toHaveBeenCalledWith( diff --git a/lib/personalAccessKey.ts b/lib/personalAccessKey.ts index 3804291f..d9ae3260 100644 --- a/lib/personalAccessKey.ts +++ b/lib/personalAccessKey.ts @@ -149,8 +149,8 @@ export async function accessTokenForPersonalAccessKey( // Adds an account to the config using authType: personalAccessKey export const updateConfigWithPersonalAccessKey = async ( personalAccessKey: string, - name: string, - env: Environment, + env?: Environment, + name?: string, makeDefault = false ): Promise => { const accountEnv = env || getEnv(name); @@ -192,7 +192,7 @@ export const updateConfigWithPersonalAccessKey = async ( }); writeConfig(); - if (makeDefault) { + if (makeDefault && name) { updateDefaultAccount(name); }