Skip to content

Commit

Permalink
Merge pull request #70 from HubSpot/update-pak-types
Browse files Browse the repository at this point in the history
Slight tweaks to updateConfigWithPersonalAccessKey
  • Loading branch information
camden11 authored Dec 8, 2023
2 parents 80760f1 + 9585bfb commit c0c2d8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/__tests__/personalAccessKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ describe('lib/personalAccessKey', () => {

await updateConfigWithPersonalAccessKey(
'pak_123',
'account-name',
ENVIRONMENTS.QA
ENVIRONMENTS.QA,
'account-name'
);

expect(updateAccountConfig).toHaveBeenCalledWith(
Expand All @@ -222,8 +222,8 @@ describe('lib/personalAccessKey', () => {

await updateConfigWithPersonalAccessKey(
'pak_123',
'account-name',
ENVIRONMENTS.QA
ENVIRONMENTS.QA,
'account-name'
);

expect(updateAccountConfig).toHaveBeenCalledWith(
Expand Down
6 changes: 3 additions & 3 deletions lib/personalAccessKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<CLIAccount | null> => {
const accountEnv = env || getEnv(name);
Expand Down Expand Up @@ -192,7 +192,7 @@ export const updateConfigWithPersonalAccessKey = async (
});
writeConfig();

if (makeDefault) {
if (makeDefault && name) {
updateDefaultAccount(name);
}

Expand Down

0 comments on commit c0c2d8c

Please sign in to comment.