File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -441,6 +441,18 @@ describe('config/index', () => {
441441
442442 expect ( ( ) => updateConfigAccount ( OAUTH_ACCOUNT ) ) . toThrow ( ) ;
443443 } ) ;
444+
445+ it ( 'skips updating config file when using environment variables' , ( ) => {
446+ mockConfig ( ) ;
447+ process . env [ ENVIRONMENT_VARIABLES . USE_ENVIRONMENT_HUBSPOT_CONFIG ] =
448+ 'true' ;
449+
450+ const newAccount = { ...PAK_ACCOUNT , name : 'new-name' } ;
451+
452+ updateConfigAccount ( newAccount ) ;
453+
454+ expect ( mockFs . writeFileSync ) . not . toHaveBeenCalled ( ) ;
455+ } ) ;
444456 } ) ;
445457
446458 describe ( 'setConfigAccountAsDefault()' , ( ) => {
Original file line number Diff line number Diff line change 77 GLOBAL_CONFIG_PATH ,
88 HUBSPOT_CONFIG_OPERATIONS ,
99 MIN_HTTP_TIMEOUT ,
10+ ENVIRONMENT_VARIABLES ,
1011} from '../constants/config' ;
1112import { HubSpotConfigAccount } from '../types/Accounts' ;
1213import {
@@ -390,6 +391,10 @@ export function addConfigAccount(accountToAdd: HubSpotConfigAccount): void {
390391export function updateConfigAccount (
391392 updatedAccount : HubSpotConfigAccount
392393) : void {
394+ // Skip updating the config file if we're using environment variables
395+ if ( process . env [ ENVIRONMENT_VARIABLES . USE_ENVIRONMENT_HUBSPOT_CONFIG ] ) {
396+ return ;
397+ }
393398 if ( ! validateConfigAccount ( updatedAccount ) ) {
394399 throw new HubSpotConfigError (
395400 i18n ( 'config.updateConfigAccount.invalidAccount' , {
You can’t perform that action at this time.
0 commit comments