@hubspot/cli 8.3.0 → 8.4.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +2 -0
- package/commands/account/auth.js +12 -22
- package/commands/account/clean.js +5 -6
- package/commands/account/createOverride.js +7 -7
- package/commands/account/info.js +2 -1
- package/commands/account/list.js +3 -5
- package/commands/account/remove.js +2 -3
- package/commands/account/removeOverride.js +8 -10
- package/commands/account/rename.js +5 -6
- package/commands/account/use.js +8 -19
- package/commands/api.d.ts +10 -0
- package/commands/api.js +164 -0
- package/commands/app/migrate.js +8 -8
- package/commands/app/secret/add.js +6 -7
- package/commands/app/secret/delete.js +9 -10
- package/commands/app/secret/list.js +6 -7
- package/commands/app/secret/update.js +8 -9
- package/commands/auth.js +12 -12
- package/commands/cms/app/create.js +9 -5
- package/commands/cms/convertFields.js +8 -8
- package/commands/cms/delete.js +2 -3
- package/commands/cms/fetch.js +7 -7
- package/commands/cms/function/create.js +9 -5
- package/commands/cms/function/deploy.js +2 -3
- package/commands/cms/function/list.js +11 -7
- package/commands/cms/function/logs.js +17 -23
- package/commands/cms/function/server.js +2 -3
- package/commands/cms/getReactModule.js +7 -8
- package/commands/cms/lighthouseScore.js +25 -24
- package/commands/cms/lint.js +4 -5
- package/commands/cms/list.js +5 -6
- package/commands/cms/module/create.js +9 -5
- package/commands/cms/module/marketplace-validate.js +7 -8
- package/commands/cms/mv.js +2 -3
- package/commands/cms/template/create.js +10 -6
- package/commands/cms/theme/create.js +5 -5
- package/commands/cms/theme/generate-selectors.js +5 -4
- package/commands/cms/theme/marketplace-validate.js +8 -9
- package/commands/cms/theme/preview.js +16 -8
- package/commands/cms/upload.js +15 -12
- package/commands/cms/watch.js +5 -5
- package/commands/cms/webpack/create.js +5 -5
- package/commands/completion.js +3 -5
- package/commands/config/migrate.js +6 -7
- package/commands/config/set.js +5 -6
- package/commands/customObject/create.js +4 -5
- package/commands/customObject/createSchema.js +4 -5
- package/commands/customObject/deleteSchema.js +4 -5
- package/commands/customObject/fetchAllSchemas.js +2 -3
- package/commands/customObject/fetchSchema.js +2 -3
- package/commands/customObject/listSchemas.js +2 -3
- package/commands/customObject/updateSchema.js +4 -5
- package/commands/doctor.js +8 -8
- package/commands/feedback.js +6 -4
- package/commands/filemanager/fetch.js +5 -6
- package/commands/filemanager/upload.js +5 -5
- package/commands/getStarted.js +14 -16
- package/commands/hubdb/clear.js +5 -6
- package/commands/hubdb/create.js +4 -5
- package/commands/hubdb/delete.js +8 -9
- package/commands/hubdb/fetch.js +5 -6
- package/commands/hubdb/list.js +16 -14
- package/commands/init.js +14 -17
- package/commands/mcp/setup.js +5 -6
- package/commands/mcp/start.js +2 -3
- package/commands/open.js +4 -5
- package/commands/project/add.js +10 -5
- package/commands/project/create.js +10 -10
- package/commands/project/delete.d.ts +7 -0
- package/commands/project/delete.js +74 -0
- package/commands/project/deploy.js +36 -34
- package/commands/project/dev/deprecatedFlow.js +42 -15
- package/commands/project/dev/index.d.ts +3 -3
- package/commands/project/dev/index.js +24 -30
- package/commands/project/dev/unifiedFlow.js +37 -14
- package/commands/project/download.js +10 -11
- package/commands/project/info.d.ts +4 -0
- package/commands/project/info.js +67 -0
- package/commands/project/installDeps.js +9 -6
- package/commands/project/lint.js +11 -8
- package/commands/project/list.js +14 -14
- package/commands/project/listBuilds.js +8 -6
- package/commands/project/logs.js +5 -6
- package/commands/project/migrate.js +8 -8
- package/commands/project/open.js +5 -6
- package/commands/project/profile/add.js +12 -8
- package/commands/project/profile/delete.js +15 -11
- package/commands/project/updateDeps.js +9 -6
- package/commands/project/upload.js +31 -17
- package/commands/project/validate.js +11 -11
- package/commands/project/watch.js +20 -20
- package/commands/project.js +4 -0
- package/commands/sandbox/create.js +15 -15
- package/commands/sandbox/delete.js +13 -14
- package/commands/secret/addSecret.js +6 -7
- package/commands/secret/deleteSecret.js +5 -6
- package/commands/secret/listSecret.js +2 -3
- package/commands/secret/updateSecret.js +4 -5
- package/commands/testAccount/create.d.ts +1 -1
- package/commands/testAccount/create.js +20 -16
- package/commands/testAccount/createConfig.js +7 -8
- package/commands/testAccount/delete.js +27 -18
- package/commands/testAccount/importData.js +6 -7
- package/commands/upgrade.js +9 -10
- package/lang/en.d.ts +114 -5
- package/lang/en.js +111 -5
- package/lib/accountAuth.js +2 -2
- package/lib/buildAccount.js +3 -3
- package/lib/doctor/Diagnosis.js +5 -5
- package/lib/errorHandlers/index.js +4 -3
- package/lib/errorHandlers/suppressError.js +4 -0
- package/lib/errors/PromptExitError.d.ts +4 -2
- package/lib/errors/PromptExitError.js +3 -0
- package/lib/process.d.ts +1 -1
- package/lib/process.js +10 -3
- package/lib/projects/delete.d.ts +13 -0
- package/lib/projects/delete.js +193 -0
- package/lib/projects/localDev/AppDevModeInterface.js +11 -11
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +3 -1
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +2 -2
- package/lib/projects/localDev/DevSessionManager.d.ts +6 -3
- package/lib/projects/localDev/DevSessionManager.js +31 -19
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.d.ts +3 -0
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +16 -12
- package/lib/projects/localDev/LocalDevProcess.js +6 -5
- package/lib/projects/localDev/LocalDevState.d.ts +3 -2
- package/lib/projects/localDev/LocalDevState.js +3 -1
- package/lib/projects/localDev/helpers/account.d.ts +4 -3
- package/lib/projects/localDev/helpers/account.js +16 -19
- package/lib/projects/localDev/helpers/process.d.ts +1 -1
- package/lib/projects/localDev/helpers/process.js +4 -10
- package/lib/projects/localDev/helpers/project.d.ts +4 -3
- package/lib/projects/localDev/helpers/project.js +31 -15
- package/lib/projects/projectInfo.d.ts +5 -0
- package/lib/projects/projectInfo.js +82 -0
- package/lib/projects/projectProfiles.d.ts +1 -2
- package/lib/projects/projectProfiles.js +5 -17
- package/lib/prompts/createApiSamplePrompt.js +4 -0
- package/lib/prompts/projectProfilePrompt.d.ts +2 -0
- package/lib/prompts/projectProfilePrompt.js +46 -0
- package/lib/prompts/promptUtils.js +3 -2
- package/lib/prompts/selectHubDBTablePrompt.js +2 -2
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +2 -2
- package/lib/theme/cmsDevServerProcess.d.ts +2 -0
- package/lib/theme/cmsDevServerProcess.js +7 -6
- package/lib/ui/SpinniesManager.d.ts +1 -0
- package/lib/ui/SpinniesManager.js +20 -6
- package/lib/ui/spinniesUtils.d.ts +0 -1
- package/lib/ui/spinniesUtils.js +6 -16
- package/lib/usageTracking.d.ts +3 -4
- package/lib/yargs/makeYargsBuilder.d.ts +13 -0
- package/lib/yargs/makeYargsBuilder.js +33 -0
- package/lib/yargs/makeYargsHandlerWithUsageTracking.d.ts +3 -0
- package/lib/yargs/makeYargsHandlerWithUsageTracking.js +95 -0
- package/lib/yargs/strictEnforceBoolean.d.ts +1 -0
- package/lib/yargs/strictEnforceBoolean.js +13 -0
- package/lib/yargsUtils.d.ts +3 -16
- package/lib/yargsUtils.js +3 -48
- package/package.json +9 -4
- package/types/LocalDev.d.ts +5 -0
- package/types/Projects.d.ts +19 -0
- package/types/Yargs.d.ts +18 -1
- package/api/__tests__/migrate.test.d.ts +0 -1
- package/api/__tests__/migrate.test.js +0 -199
- package/commands/__tests__/account.test.d.ts +0 -1
- package/commands/__tests__/account.test.js +0 -69
- package/commands/__tests__/auth.test.d.ts +0 -1
- package/commands/__tests__/auth.test.js +0 -43
- package/commands/__tests__/cms.test.d.ts +0 -1
- package/commands/__tests__/cms.test.js +0 -87
- package/commands/__tests__/config.test.d.ts +0 -1
- package/commands/__tests__/config.test.js +0 -44
- package/commands/__tests__/customObject.test.d.ts +0 -1
- package/commands/__tests__/customObject.test.js +0 -68
- package/commands/__tests__/doctor.test.d.ts +0 -1
- package/commands/__tests__/doctor.test.js +0 -132
- package/commands/__tests__/feedback.test.d.ts +0 -1
- package/commands/__tests__/feedback.test.js +0 -24
- package/commands/__tests__/filemanager.test.d.ts +0 -1
- package/commands/__tests__/filemanager.test.js +0 -45
- package/commands/__tests__/getStarted.test.d.ts +0 -1
- package/commands/__tests__/getStarted.test.js +0 -173
- package/commands/__tests__/hubdb.test.d.ts +0 -1
- package/commands/__tests__/hubdb.test.js +0 -50
- package/commands/__tests__/init.test.d.ts +0 -1
- package/commands/__tests__/init.test.js +0 -42
- package/commands/__tests__/mcp.test.d.ts +0 -1
- package/commands/__tests__/mcp.test.js +0 -46
- package/commands/__tests__/open.test.d.ts +0 -1
- package/commands/__tests__/open.test.js +0 -58
- package/commands/__tests__/project.test.d.ts +0 -1
- package/commands/__tests__/project.test.js +0 -125
- package/commands/__tests__/sandbox.test.d.ts +0 -1
- package/commands/__tests__/sandbox.test.js +0 -44
- package/commands/__tests__/secret.test.d.ts +0 -1
- package/commands/__tests__/secret.test.js +0 -49
- package/commands/__tests__/testAccount.test.d.ts +0 -1
- package/commands/__tests__/testAccount.test.js +0 -57
- package/commands/__tests__/upgrade.test.d.ts +0 -1
- package/commands/__tests__/upgrade.test.js +0 -309
- package/commands/account/__tests__/auth.test.d.ts +0 -1
- package/commands/account/__tests__/auth.test.js +0 -206
- package/commands/account/__tests__/clean.test.d.ts +0 -1
- package/commands/account/__tests__/clean.test.js +0 -28
- package/commands/account/__tests__/createOverride.test.d.ts +0 -1
- package/commands/account/__tests__/createOverride.test.js +0 -32
- package/commands/account/__tests__/info.test.d.ts +0 -1
- package/commands/account/__tests__/info.test.js +0 -28
- package/commands/account/__tests__/list.test.d.ts +0 -1
- package/commands/account/__tests__/list.test.js +0 -153
- package/commands/account/__tests__/remove.test.d.ts +0 -1
- package/commands/account/__tests__/remove.test.js +0 -36
- package/commands/account/__tests__/removeOverride.d.ts +0 -1
- package/commands/account/__tests__/removeOverride.js +0 -25
- package/commands/account/__tests__/rename.test.d.ts +0 -1
- package/commands/account/__tests__/rename.test.js +0 -82
- package/commands/account/__tests__/use.test.d.ts +0 -1
- package/commands/account/__tests__/use.test.js +0 -170
- package/commands/app/__tests__/migrate.test.d.ts +0 -1
- package/commands/app/__tests__/migrate.test.js +0 -111
- package/commands/app/secret/__tests__/add.test.d.ts +0 -1
- package/commands/app/secret/__tests__/add.test.js +0 -140
- package/commands/app/secret/__tests__/delete.test.d.ts +0 -1
- package/commands/app/secret/__tests__/delete.test.js +0 -28
- package/commands/app/secret/__tests__/list.test.d.ts +0 -1
- package/commands/app/secret/__tests__/list.test.js +0 -25
- package/commands/app/secret/__tests__/update.test.d.ts +0 -1
- package/commands/app/secret/__tests__/update.test.js +0 -28
- package/commands/cms/__tests__/delete.test.d.ts +0 -1
- package/commands/cms/__tests__/delete.test.js +0 -39
- package/commands/cms/__tests__/fetch.test.d.ts +0 -1
- package/commands/cms/__tests__/fetch.test.js +0 -156
- package/commands/cms/__tests__/function.test.d.ts +0 -1
- package/commands/cms/__tests__/function.test.js +0 -50
- package/commands/cms/__tests__/lint.test.d.ts +0 -1
- package/commands/cms/__tests__/lint.test.js +0 -33
- package/commands/cms/__tests__/list.test.d.ts +0 -1
- package/commands/cms/__tests__/list.test.js +0 -42
- package/commands/cms/__tests__/module.test.d.ts +0 -1
- package/commands/cms/__tests__/module.test.js +0 -45
- package/commands/cms/__tests__/mv.test.d.ts +0 -1
- package/commands/cms/__tests__/mv.test.js +0 -46
- package/commands/cms/__tests__/theme.test.d.ts +0 -1
- package/commands/cms/__tests__/theme.test.js +0 -54
- package/commands/cms/__tests__/upload.test.d.ts +0 -1
- package/commands/cms/__tests__/upload.test.js +0 -312
- package/commands/cms/__tests__/watch.test.d.ts +0 -1
- package/commands/cms/__tests__/watch.test.js +0 -204
- package/commands/cms/function/__tests__/logs.test.d.ts +0 -1
- package/commands/cms/function/__tests__/logs.test.js +0 -70
- package/commands/cms/theme/__tests__/generate-selectors.test.d.ts +0 -1
- package/commands/cms/theme/__tests__/generate-selectors.test.js +0 -28
- package/commands/cms/theme/__tests__/marketplace-validate.test.d.ts +0 -1
- package/commands/cms/theme/__tests__/marketplace-validate.test.js +0 -36
- package/commands/cms/theme/__tests__/preview.test.d.ts +0 -1
- package/commands/cms/theme/__tests__/preview.test.js +0 -54
- package/commands/customObject/__tests__/create.test.d.ts +0 -1
- package/commands/customObject/__tests__/create.test.js +0 -40
- package/commands/customObject/__tests__/createSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/createSchema.test.js +0 -28
- package/commands/customObject/__tests__/deleteSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/deleteSchema.test.js +0 -42
- package/commands/customObject/__tests__/fetch-all-schemas.test.d.ts +0 -1
- package/commands/customObject/__tests__/fetch-all-schemas.test.js +0 -41
- package/commands/customObject/__tests__/fetchSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/fetchSchema.test.js +0 -45
- package/commands/customObject/__tests__/listSchemas.test.d.ts +0 -1
- package/commands/customObject/__tests__/listSchemas.test.js +0 -29
- package/commands/customObject/__tests__/updateSchema.test.d.ts +0 -1
- package/commands/customObject/__tests__/updateSchema.test.js +0 -40
- package/commands/filemanager/__tests__/fetch.test.d.ts +0 -1
- package/commands/filemanager/__tests__/fetch.test.js +0 -32
- package/commands/filemanager/__tests__/upload.test.d.ts +0 -1
- package/commands/filemanager/__tests__/upload.test.js +0 -191
- package/commands/hubdb/__tests__/clear.test.d.ts +0 -1
- package/commands/hubdb/__tests__/clear.test.js +0 -28
- package/commands/hubdb/__tests__/create.test.d.ts +0 -1
- package/commands/hubdb/__tests__/create.test.js +0 -28
- package/commands/hubdb/__tests__/delete.test.d.ts +0 -1
- package/commands/hubdb/__tests__/delete.test.js +0 -28
- package/commands/hubdb/__tests__/fetch.test.d.ts +0 -1
- package/commands/hubdb/__tests__/fetch.test.js +0 -28
- package/commands/hubdb/__tests__/list.test.d.ts +0 -1
- package/commands/hubdb/__tests__/list.test.js +0 -88
- package/commands/mcp/__tests__/setup.test.d.ts +0 -1
- package/commands/mcp/__tests__/setup.test.js +0 -26
- package/commands/mcp/__tests__/start.test.d.ts +0 -1
- package/commands/mcp/__tests__/start.test.js +0 -144
- package/commands/project/__tests__/add.test.d.ts +0 -1
- package/commands/project/__tests__/add.test.js +0 -107
- package/commands/project/__tests__/create.test.d.ts +0 -1
- package/commands/project/__tests__/create.test.js +0 -97
- package/commands/project/__tests__/deploy.test.d.ts +0 -1
- package/commands/project/__tests__/deploy.test.js +0 -307
- package/commands/project/__tests__/dev.test.d.ts +0 -1
- package/commands/project/__tests__/dev.test.js +0 -273
- package/commands/project/__tests__/devUnifiedFlow.test.d.ts +0 -1
- package/commands/project/__tests__/devUnifiedFlow.test.js +0 -434
- package/commands/project/__tests__/download.test.d.ts +0 -1
- package/commands/project/__tests__/download.test.js +0 -39
- package/commands/project/__tests__/installDeps.test.d.ts +0 -1
- package/commands/project/__tests__/installDeps.test.js +0 -140
- package/commands/project/__tests__/lint.test.d.ts +0 -1
- package/commands/project/__tests__/lint.test.js +0 -704
- package/commands/project/__tests__/list.test.d.ts +0 -1
- package/commands/project/__tests__/list.test.js +0 -31
- package/commands/project/__tests__/listBuilds.test.d.ts +0 -1
- package/commands/project/__tests__/listBuilds.test.js +0 -38
- package/commands/project/__tests__/logs.test.d.ts +0 -1
- package/commands/project/__tests__/logs.test.js +0 -202
- package/commands/project/__tests__/migrate.test.d.ts +0 -1
- package/commands/project/__tests__/migrate.test.js +0 -106
- package/commands/project/__tests__/open.test.d.ts +0 -1
- package/commands/project/__tests__/open.test.js +0 -39
- package/commands/project/__tests__/profile.test.d.ts +0 -1
- package/commands/project/__tests__/profile.test.js +0 -42
- package/commands/project/__tests__/updateDeps.test.d.ts +0 -1
- package/commands/project/__tests__/updateDeps.test.js +0 -140
- package/commands/project/__tests__/upload.test.d.ts +0 -1
- package/commands/project/__tests__/upload.test.js +0 -234
- package/commands/project/__tests__/validate.test.d.ts +0 -1
- package/commands/project/__tests__/validate.test.js +0 -381
- package/commands/project/__tests__/watch.test.d.ts +0 -1
- package/commands/project/__tests__/watch.test.js +0 -35
- package/commands/sandbox/__tests__/create.test.d.ts +0 -1
- package/commands/sandbox/__tests__/create.test.js +0 -198
- package/commands/sandbox/__tests__/delete.test.d.ts +0 -1
- package/commands/sandbox/__tests__/delete.test.js +0 -31
- package/commands/secret/__tests__/addSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/addSecret.test.js +0 -162
- package/commands/secret/__tests__/deleteSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/deleteSecret.test.js +0 -41
- package/commands/secret/__tests__/listSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/listSecret.test.js +0 -29
- package/commands/secret/__tests__/updateSecret.test.d.ts +0 -1
- package/commands/secret/__tests__/updateSecret.test.js +0 -29
- package/commands/testAccount/__tests__/create.test.d.ts +0 -1
- package/commands/testAccount/__tests__/create.test.js +0 -106
- package/commands/testAccount/__tests__/createConfig.test.d.ts +0 -1
- package/commands/testAccount/__tests__/createConfig.test.js +0 -32
- package/commands/testAccount/__tests__/delete.test.d.ts +0 -1
- package/commands/testAccount/__tests__/delete.test.js +0 -29
- package/commands/testAccount/__tests__/importData.test.d.ts +0 -1
- package/commands/testAccount/__tests__/importData.test.js +0 -92
- package/lib/__tests__/CLIWebSocketServer.test.d.ts +0 -1
- package/lib/__tests__/CLIWebSocketServer.test.js +0 -252
- package/lib/__tests__/accountAuth.test.d.ts +0 -1
- package/lib/__tests__/accountAuth.test.js +0 -258
- package/lib/__tests__/accountTypes.test.d.ts +0 -1
- package/lib/__tests__/accountTypes.test.js +0 -98
- package/lib/__tests__/buildAccount.test.d.ts +0 -1
- package/lib/__tests__/buildAccount.test.js +0 -211
- package/lib/__tests__/cliUpgradeUtils.test.d.ts +0 -1
- package/lib/__tests__/cliUpgradeUtils.test.js +0 -131
- package/lib/__tests__/commandSuggestion.test.d.ts +0 -1
- package/lib/__tests__/commandSuggestion.test.js +0 -121
- package/lib/__tests__/commonOpts.test.d.ts +0 -1
- package/lib/__tests__/commonOpts.test.js +0 -80
- package/lib/__tests__/dependencyManagement.test.d.ts +0 -1
- package/lib/__tests__/dependencyManagement.test.js +0 -1067
- package/lib/__tests__/developerTestAccounts.test.d.ts +0 -1
- package/lib/__tests__/developerTestAccounts.test.js +0 -156
- package/lib/__tests__/hasFeature.test.d.ts +0 -1
- package/lib/__tests__/hasFeature.test.js +0 -167
- package/lib/__tests__/http.test.d.ts +0 -1
- package/lib/__tests__/http.test.js +0 -40
- package/lib/__tests__/importData.test.d.ts +0 -1
- package/lib/__tests__/importData.test.js +0 -98
- package/lib/__tests__/npmCli.test.d.ts +0 -1
- package/lib/__tests__/npmCli.test.js +0 -84
- package/lib/__tests__/oauth.test.d.ts +0 -1
- package/lib/__tests__/oauth.test.js +0 -109
- package/lib/__tests__/parsing.test.d.ts +0 -1
- package/lib/__tests__/parsing.test.js +0 -34
- package/lib/__tests__/polling.test.d.ts +0 -1
- package/lib/__tests__/polling.test.js +0 -76
- package/lib/__tests__/process.test.d.ts +0 -1
- package/lib/__tests__/process.test.js +0 -89
- package/lib/__tests__/sandboxes.test.d.ts +0 -1
- package/lib/__tests__/sandboxes.test.js +0 -128
- package/lib/__tests__/serverlessLogs.test.d.ts +0 -1
- package/lib/__tests__/serverlessLogs.test.js +0 -163
- package/lib/__tests__/usageTracking.test.d.ts +0 -1
- package/lib/__tests__/usageTracking.test.js +0 -197
- package/lib/__tests__/validation.test.d.ts +0 -1
- package/lib/__tests__/validation.test.js +0 -143
- package/lib/__tests__/yargsUtils.test.d.ts +0 -1
- package/lib/__tests__/yargsUtils.test.js +0 -124
- package/lib/app/__tests__/migrate.test.d.ts +0 -1
- package/lib/app/__tests__/migrate.test.js +0 -638
- package/lib/doctor/__tests__/Diagnosis.test.d.ts +0 -1
- package/lib/doctor/__tests__/Diagnosis.test.js +0 -84
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.d.ts +0 -1
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +0 -177
- package/lib/doctor/__tests__/Doctor.test.d.ts +0 -1
- package/lib/doctor/__tests__/Doctor.test.js +0 -560
- package/lib/errorHandlers/__tests__/index.test.d.ts +0 -1
- package/lib/errorHandlers/__tests__/index.test.js +0 -278
- package/lib/mcp/__tests__/setup.test.d.ts +0 -1
- package/lib/mcp/__tests__/setup.test.js +0 -523
- package/lib/middleware/__tests__/commandTargetingUtils.test.d.ts +0 -1
- package/lib/middleware/__tests__/commandTargetingUtils.test.js +0 -99
- package/lib/middleware/__tests__/configMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/configMiddleware.test.js +0 -118
- package/lib/middleware/__tests__/gitMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/gitMiddleware.test.js +0 -43
- package/lib/middleware/__tests__/requestMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/requestMiddleware.test.js +0 -15
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.js +0 -44
- package/lib/middleware/__tests__/yargsChecksMiddleware.test.d.ts +0 -1
- package/lib/middleware/__tests__/yargsChecksMiddleware.test.js +0 -39
- package/lib/projects/__tests__/AppDevModeInterface.test.d.ts +0 -1
- package/lib/projects/__tests__/AppDevModeInterface.test.js +0 -541
- package/lib/projects/__tests__/DevServerManager.test.d.ts +0 -1
- package/lib/projects/__tests__/DevServerManager.test.js +0 -185
- package/lib/projects/__tests__/DevSessionManager.test.d.ts +0 -1
- package/lib/projects/__tests__/DevSessionManager.test.js +0 -250
- package/lib/projects/__tests__/LocalDevProcess.test.d.ts +0 -1
- package/lib/projects/__tests__/LocalDevProcess.test.js +0 -481
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.d.ts +0 -1
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +0 -231
- package/lib/projects/__tests__/ProjectLogsManager.test.d.ts +0 -1
- package/lib/projects/__tests__/ProjectLogsManager.test.js +0 -302
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.d.ts +0 -1
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +0 -160
- package/lib/projects/__tests__/components.test.d.ts +0 -1
- package/lib/projects/__tests__/components.test.js +0 -440
- package/lib/projects/__tests__/deploy.test.d.ts +0 -1
- package/lib/projects/__tests__/deploy.test.js +0 -231
- package/lib/projects/__tests__/localDevProjectHelpers.test.d.ts +0 -1
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +0 -120
- package/lib/projects/__tests__/platformVersion.test.d.ts +0 -1
- package/lib/projects/__tests__/platformVersion.test.js +0 -63
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.d.ts +0 -1
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.js +0 -328
- package/lib/projects/__tests__/projectProfiles.test.d.ts +0 -1
- package/lib/projects/__tests__/projectProfiles.test.js +0 -441
- package/lib/projects/__tests__/projects.test.d.ts +0 -1
- package/lib/projects/__tests__/projects.test.js +0 -58
- package/lib/projects/__tests__/structure.test.d.ts +0 -1
- package/lib/projects/__tests__/structure.test.js +0 -210
- package/lib/projects/__tests__/uieLinting.test.d.ts +0 -1
- package/lib/projects/__tests__/uieLinting.test.js +0 -631
- package/lib/projects/__tests__/upload.test.d.ts +0 -1
- package/lib/projects/__tests__/upload.test.js +0 -183
- package/lib/projects/add/__tests__/legacyAddComponent.test.d.ts +0 -1
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +0 -245
- package/lib/projects/add/__tests__/v2AddComponent.test.d.ts +0 -1
- package/lib/projects/add/__tests__/v2AddComponent.test.js +0 -343
- package/lib/projects/create/__tests__/legacy.test.d.ts +0 -1
- package/lib/projects/create/__tests__/legacy.test.js +0 -72
- package/lib/projects/create/__tests__/v2.test.d.ts +0 -1
- package/lib/projects/create/__tests__/v2.test.js +0 -257
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.js +0 -157
- package/lib/prompts/__tests__/createFunctionPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createFunctionPrompt.test.js +0 -129
- package/lib/prompts/__tests__/createModulePrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createModulePrompt.test.js +0 -187
- package/lib/prompts/__tests__/createTemplatePrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/createTemplatePrompt.test.js +0 -102
- package/lib/prompts/__tests__/downloadProjectPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +0 -31
- package/lib/prompts/__tests__/projectAddPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/projectAddPrompt.test.js +0 -143
- package/lib/prompts/__tests__/projectsLogsPrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/projectsLogsPrompt.test.js +0 -37
- package/lib/prompts/__tests__/selectProjectTemplatePrompt.test.d.ts +0 -1
- package/lib/prompts/__tests__/selectProjectTemplatePrompt.test.js +0 -160
- package/lib/theme/__tests__/migrate.test.d.ts +0 -1
- package/lib/theme/__tests__/migrate.test.js +0 -247
- package/lib/ui/__tests__/SpinniesManager.test.d.ts +0 -1
- package/lib/ui/__tests__/SpinniesManager.test.js +0 -488
- package/lib/ui/__tests__/removeAnsiCodes.test.d.ts +0 -1
- package/lib/ui/__tests__/removeAnsiCodes.test.js +0 -84
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +0 -254
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +0 -227
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +0 -208
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +0 -186
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +0 -124
- package/mcp-server/tools/cms/__tests__/HsListTool.test.d.ts +0 -1
- package/mcp-server/tools/cms/__tests__/HsListTool.test.js +0 -124
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +0 -157
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +0 -131
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +0 -461
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +0 -125
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +0 -125
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +0 -210
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +0 -146
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +0 -124
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.js +0 -307
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.js +0 -242
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +0 -209
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +0 -158
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +0 -187
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.d.ts +0 -1
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +0 -118
- package/mcp-server/utils/__tests__/command.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/command.test.js +0 -275
- package/mcp-server/utils/__tests__/content.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/content.test.js +0 -164
- package/mcp-server/utils/__tests__/feedbackTracking.test.d.ts +0 -1
- package/mcp-server/utils/__tests__/feedbackTracking.test.js +0 -69
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import yargs from 'yargs';
|
|
2
|
-
import { addConfigOptions, addUseEnvironmentOptions, addTestingOptions, } from '../../../lib/commonOpts.js';
|
|
3
|
-
import testAccountDeleteCommand from '../delete.js';
|
|
4
|
-
vi.mock('../../../lib/commonOpts');
|
|
5
|
-
describe('commands/testAccount/delete', () => {
|
|
6
|
-
const yargsMock = yargs;
|
|
7
|
-
describe('command', () => {
|
|
8
|
-
it('should have the correct command structure', () => {
|
|
9
|
-
expect(testAccountDeleteCommand.command).toEqual('delete [test-account]');
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
describe('describe', () => {
|
|
13
|
-
it('should provide a description', () => {
|
|
14
|
-
expect(testAccountDeleteCommand.describe).toBeDefined();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
describe('builder', () => {
|
|
18
|
-
it('should support the correct options', () => {
|
|
19
|
-
testAccountDeleteCommand.builder(yargsMock);
|
|
20
|
-
expect(yargsMock.example).toHaveBeenCalledTimes(1);
|
|
21
|
-
expect(addTestingOptions).toHaveBeenCalledTimes(1);
|
|
22
|
-
expect(addTestingOptions).toHaveBeenCalledWith(yargsMock);
|
|
23
|
-
expect(addConfigOptions).toHaveBeenCalledTimes(1);
|
|
24
|
-
expect(addConfigOptions).toHaveBeenCalledWith(yargsMock);
|
|
25
|
-
expect(addUseEnvironmentOptions).toHaveBeenCalledTimes(1);
|
|
26
|
-
expect(addUseEnvironmentOptions).toHaveBeenCalledWith(yargsMock);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import yargs from 'yargs';
|
|
2
|
-
import { addAccountOptions, addConfigOptions, addUseEnvironmentOptions, } from '../../../lib/commonOpts.js';
|
|
3
|
-
import testAccountImportDataCommand from '../importData.js';
|
|
4
|
-
import { EXIT_CODES } from '../../../lib/enums/exitCodes.js';
|
|
5
|
-
import { handleImportData, handleTargetTestAccountSelectionFlow, } from '../../../lib/importData.js';
|
|
6
|
-
import { trackCommandUsage } from '../../../lib/usageTracking.js';
|
|
7
|
-
import { getImportDataRequest } from '@hubspot/local-dev-lib/crm';
|
|
8
|
-
import { logError } from '../../../lib/errorHandlers/index.js';
|
|
9
|
-
import { importDataFilePathPrompt } from '../../../lib/prompts/importDataFilePathPrompt.js';
|
|
10
|
-
import { confirmImportDataPrompt } from '../../../lib/prompts/confirmImportDataPrompt.js';
|
|
11
|
-
vi.mock('../../../lib/commonOpts');
|
|
12
|
-
vi.mock('../../../lib/importData');
|
|
13
|
-
vi.mock('@hubspot/local-dev-lib/crm');
|
|
14
|
-
vi.mock('../../../lib/errorHandlers/index');
|
|
15
|
-
vi.mock('../../../lib/prompts/importDataFilePathPrompt');
|
|
16
|
-
vi.mock('../../../lib/prompts/confirmImportDataPrompt');
|
|
17
|
-
describe('commands/testAccount/importData', () => {
|
|
18
|
-
const yargsMock = yargs;
|
|
19
|
-
const mockExit = vi
|
|
20
|
-
.spyOn(process, 'exit')
|
|
21
|
-
.mockImplementation(() => undefined);
|
|
22
|
-
const mockHandleImportData = vi.mocked(handleImportData);
|
|
23
|
-
const mockHandleTargetTestAccountSelectionFlow = vi.mocked(handleTargetTestAccountSelectionFlow);
|
|
24
|
-
const mockTrackCommandUsage = vi.mocked(trackCommandUsage);
|
|
25
|
-
const mockGetImportDataRequest = vi.mocked(getImportDataRequest);
|
|
26
|
-
const mockLogError = vi.mocked(logError);
|
|
27
|
-
const mockImportDataFilePathPrompt = vi.mocked(importDataFilePathPrompt);
|
|
28
|
-
const mockConfirmImportDataPrompt = vi.mocked(confirmImportDataPrompt);
|
|
29
|
-
beforeEach(() => {
|
|
30
|
-
mockExit.mockReset();
|
|
31
|
-
mockHandleImportData.mockReset();
|
|
32
|
-
mockHandleTargetTestAccountSelectionFlow.mockReset();
|
|
33
|
-
mockTrackCommandUsage.mockReset();
|
|
34
|
-
mockGetImportDataRequest.mockReset();
|
|
35
|
-
mockLogError.mockReset();
|
|
36
|
-
mockImportDataFilePathPrompt.mockReset();
|
|
37
|
-
mockConfirmImportDataPrompt.mockReset();
|
|
38
|
-
});
|
|
39
|
-
describe('command', () => {
|
|
40
|
-
it('should have the correct command structure', () => {
|
|
41
|
-
expect(testAccountImportDataCommand.command).toEqual('import-data');
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
// describe('describe', () => {
|
|
45
|
-
// it('should provide a description', () => {
|
|
46
|
-
// expect(testAccountImportDataCommand.describe).toBeDefined();
|
|
47
|
-
// });
|
|
48
|
-
// });
|
|
49
|
-
describe('builder', () => {
|
|
50
|
-
it('should support the correct options', () => {
|
|
51
|
-
testAccountImportDataCommand.builder(yargsMock);
|
|
52
|
-
expect(yargsMock.example).toHaveBeenCalledTimes(1);
|
|
53
|
-
expect(yargsMock.options).toHaveBeenCalledTimes(1);
|
|
54
|
-
expect(addAccountOptions).toHaveBeenCalledTimes(1);
|
|
55
|
-
expect(addAccountOptions).toHaveBeenCalledWith(yargsMock);
|
|
56
|
-
expect(addConfigOptions).toHaveBeenCalledTimes(1);
|
|
57
|
-
expect(addConfigOptions).toHaveBeenCalledWith(yargsMock);
|
|
58
|
-
expect(addUseEnvironmentOptions).toHaveBeenCalledTimes(1);
|
|
59
|
-
expect(addUseEnvironmentOptions).toHaveBeenCalledWith(yargsMock);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
describe('handler', () => {
|
|
63
|
-
it('should complete the flow given the correct args', async () => {
|
|
64
|
-
const targetAccountId = 123456789;
|
|
65
|
-
const mockArgs = {
|
|
66
|
-
d: false,
|
|
67
|
-
debug: false,
|
|
68
|
-
_: [],
|
|
69
|
-
$0: 'hs',
|
|
70
|
-
derivedAccountId: targetAccountId,
|
|
71
|
-
userProvidedAccount: 'test-account',
|
|
72
|
-
filePath: 'test-file.json',
|
|
73
|
-
skipConfirm: true,
|
|
74
|
-
};
|
|
75
|
-
mockHandleTargetTestAccountSelectionFlow.mockResolvedValue(targetAccountId);
|
|
76
|
-
mockGetImportDataRequest.mockReturnValue({
|
|
77
|
-
importRequest: {},
|
|
78
|
-
dataFileNames: ['test-file.json'],
|
|
79
|
-
});
|
|
80
|
-
mockHandleImportData.mockResolvedValue();
|
|
81
|
-
await testAccountImportDataCommand.handler(mockArgs);
|
|
82
|
-
expect(mockHandleTargetTestAccountSelectionFlow).toHaveBeenCalledWith(123456789, 'test-account');
|
|
83
|
-
expect(mockGetImportDataRequest).toHaveBeenCalledWith('test-file.json');
|
|
84
|
-
expect(mockHandleImportData).toHaveBeenCalledTimes(1);
|
|
85
|
-
expect(mockTrackCommandUsage).toHaveBeenCalledTimes(1);
|
|
86
|
-
expect(mockLogError).not.toHaveBeenCalled();
|
|
87
|
-
expect(mockImportDataFilePathPrompt).not.toHaveBeenCalled();
|
|
88
|
-
expect(mockConfirmImportDataPrompt).not.toHaveBeenCalled();
|
|
89
|
-
expect(mockExit).toHaveBeenCalledWith(EXIT_CODES.SUCCESS);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import { WebSocketServer } from 'ws';
|
|
2
|
-
import { isPortManagerServerRunning, requestPorts, } from '@hubspot/local-dev-lib/portManager';
|
|
3
|
-
import { uiLogger } from '../ui/logger.js';
|
|
4
|
-
import CLIWebSocketServer from '../CLIWebSocketServer.js';
|
|
5
|
-
import { lib } from '../../lang/en.js';
|
|
6
|
-
import { pkg } from '../jsonLoader.js';
|
|
7
|
-
vi.mock('ws');
|
|
8
|
-
vi.mock('@hubspot/local-dev-lib/portManager');
|
|
9
|
-
const INSTANCE_ID = 'test-websocket-server';
|
|
10
|
-
const LOG_PREFIX = '[TestWebSocketServer]';
|
|
11
|
-
const PORT = 1234;
|
|
12
|
-
describe('CLIWebSocketServer', () => {
|
|
13
|
-
let mockWebSocket;
|
|
14
|
-
let mockWebSocketServer;
|
|
15
|
-
let server;
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
mockWebSocket = {
|
|
18
|
-
on: vi.fn(),
|
|
19
|
-
send: vi.fn(),
|
|
20
|
-
close: vi.fn(),
|
|
21
|
-
};
|
|
22
|
-
mockWebSocketServer = {
|
|
23
|
-
on: vi.fn(),
|
|
24
|
-
close: vi.fn(),
|
|
25
|
-
};
|
|
26
|
-
WebSocketServer.mockImplementation(() => mockWebSocketServer);
|
|
27
|
-
server = new CLIWebSocketServer({
|
|
28
|
-
instanceId: INSTANCE_ID,
|
|
29
|
-
logPrefix: LOG_PREFIX,
|
|
30
|
-
debug: true,
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
describe('start()', () => {
|
|
34
|
-
it('should throw error if port manager is not running', async () => {
|
|
35
|
-
isPortManagerServerRunning.mockResolvedValue(false);
|
|
36
|
-
await expect(server.start({})).rejects.toThrow(lib.CLIWebsocketServer.errors.portManagerNotRunning(LOG_PREFIX));
|
|
37
|
-
});
|
|
38
|
-
it('should start websocket server on the assigned port', async () => {
|
|
39
|
-
isPortManagerServerRunning.mockResolvedValue(true);
|
|
40
|
-
requestPorts.mockResolvedValue({
|
|
41
|
-
[INSTANCE_ID]: PORT,
|
|
42
|
-
});
|
|
43
|
-
await server.start({});
|
|
44
|
-
expect(WebSocketServer).toHaveBeenCalledWith({ port: PORT });
|
|
45
|
-
expect(mockWebSocketServer.on).toHaveBeenCalledWith('connection', expect.any(Function));
|
|
46
|
-
});
|
|
47
|
-
it('should log startup message when debug is enabled', async () => {
|
|
48
|
-
isPortManagerServerRunning.mockResolvedValue(true);
|
|
49
|
-
requestPorts.mockResolvedValue({
|
|
50
|
-
[INSTANCE_ID]: PORT,
|
|
51
|
-
});
|
|
52
|
-
await server.start({});
|
|
53
|
-
expect(uiLogger.log).toHaveBeenCalledWith(expect.stringContaining(String(PORT)));
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
describe('origin validation', () => {
|
|
57
|
-
const validOrigins = [
|
|
58
|
-
'https://app.hubspot.com',
|
|
59
|
-
'https://app.hubspotqa.com',
|
|
60
|
-
'https://local.hubspot.com',
|
|
61
|
-
'https://local.hubspotqa.com',
|
|
62
|
-
'https://app-na2.hubspot.com',
|
|
63
|
-
'https://app-na2.hubspotqa.com',
|
|
64
|
-
'https://app-na3.hubspot.com',
|
|
65
|
-
'https://app-na3.hubspotqa.com',
|
|
66
|
-
'https://app-ap1.hubspot.com',
|
|
67
|
-
'https://app-ap1.hubspotqa.com',
|
|
68
|
-
'https://app-eu1.hubspot.com',
|
|
69
|
-
'https://app-eu1.hubspotqa.com',
|
|
70
|
-
];
|
|
71
|
-
let connectionCallback;
|
|
72
|
-
beforeEach(async () => {
|
|
73
|
-
isPortManagerServerRunning.mockResolvedValue(true);
|
|
74
|
-
requestPorts.mockResolvedValue({
|
|
75
|
-
[INSTANCE_ID]: PORT,
|
|
76
|
-
});
|
|
77
|
-
await server.start({});
|
|
78
|
-
connectionCallback = mockWebSocketServer.on.mock
|
|
79
|
-
.calls[0][1];
|
|
80
|
-
});
|
|
81
|
-
validOrigins.forEach(origin => {
|
|
82
|
-
it(`should accept connection from ${origin}`, () => {
|
|
83
|
-
connectionCallback(mockWebSocket, { headers: { origin } });
|
|
84
|
-
expect(mockWebSocket.close).not.toHaveBeenCalled();
|
|
85
|
-
expect(mockWebSocket.on).toHaveBeenCalledWith('message', expect.any(Function));
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
const invalidOrigins = [
|
|
89
|
-
'https://malicious-site.com',
|
|
90
|
-
'https://app.malicious-site.com',
|
|
91
|
-
'https://app.hubspot.com.evil.com',
|
|
92
|
-
];
|
|
93
|
-
invalidOrigins.forEach(origin => {
|
|
94
|
-
it(`should reject connection from "${origin}"`, () => {
|
|
95
|
-
connectionCallback(mockWebSocket, { headers: { origin } });
|
|
96
|
-
expect(mockWebSocket.close).toHaveBeenCalledWith(1008, lib.CLIWebsocketServer.errors.originNotAllowed(origin));
|
|
97
|
-
expect(mockWebSocket.on).not.toHaveBeenCalled();
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
it('should reject connection with no origin header', () => {
|
|
101
|
-
connectionCallback(mockWebSocket, { headers: {} });
|
|
102
|
-
expect(mockWebSocket.close).toHaveBeenCalledWith(1008, lib.CLIWebsocketServer.errors.originNotAllowed());
|
|
103
|
-
expect(mockWebSocket.on).not.toHaveBeenCalled();
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
describe('sendCliMetadata', () => {
|
|
107
|
-
let connectionCallback;
|
|
108
|
-
beforeEach(async () => {
|
|
109
|
-
isPortManagerServerRunning.mockResolvedValue(true);
|
|
110
|
-
requestPorts.mockResolvedValue({
|
|
111
|
-
[INSTANCE_ID]: PORT,
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
it('should send cliVersion on connection', async () => {
|
|
115
|
-
await server.start({});
|
|
116
|
-
connectionCallback = mockWebSocketServer.on.mock
|
|
117
|
-
.calls[0][1];
|
|
118
|
-
connectionCallback(mockWebSocket, {
|
|
119
|
-
headers: { origin: 'https://app.hubspot.com' },
|
|
120
|
-
});
|
|
121
|
-
expect(mockWebSocket.send).toHaveBeenCalledWith(JSON.stringify({
|
|
122
|
-
type: 'server:cliMetadata',
|
|
123
|
-
data: { cliVersion: pkg.version },
|
|
124
|
-
}));
|
|
125
|
-
});
|
|
126
|
-
it('should merge additional metadata when provided', async () => {
|
|
127
|
-
await server.start({
|
|
128
|
-
metadata: { customField: 'customValue', version: 2 },
|
|
129
|
-
});
|
|
130
|
-
connectionCallback = mockWebSocketServer.on.mock
|
|
131
|
-
.calls[0][1];
|
|
132
|
-
connectionCallback(mockWebSocket, {
|
|
133
|
-
headers: { origin: 'https://app.hubspot.com' },
|
|
134
|
-
});
|
|
135
|
-
expect(mockWebSocket.send).toHaveBeenCalledWith(JSON.stringify({
|
|
136
|
-
type: 'server:cliMetadata',
|
|
137
|
-
data: {
|
|
138
|
-
cliVersion: pkg.version,
|
|
139
|
-
customField: 'customValue',
|
|
140
|
-
version: 2,
|
|
141
|
-
},
|
|
142
|
-
}));
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
describe('callbacks', () => {
|
|
146
|
-
let connectionCallback;
|
|
147
|
-
beforeEach(async () => {
|
|
148
|
-
isPortManagerServerRunning.mockResolvedValue(true);
|
|
149
|
-
requestPorts.mockResolvedValue({
|
|
150
|
-
[INSTANCE_ID]: PORT,
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
it('should call onConnection for valid connections', async () => {
|
|
154
|
-
const onConnection = vi.fn();
|
|
155
|
-
await server.start({ onConnection });
|
|
156
|
-
connectionCallback = mockWebSocketServer.on.mock
|
|
157
|
-
.calls[0][1];
|
|
158
|
-
connectionCallback(mockWebSocket, {
|
|
159
|
-
headers: { origin: 'https://app.hubspot.com' },
|
|
160
|
-
});
|
|
161
|
-
expect(onConnection).toHaveBeenCalledWith(mockWebSocket);
|
|
162
|
-
});
|
|
163
|
-
it('should not call onConnection for rejected connections', async () => {
|
|
164
|
-
const onConnection = vi.fn();
|
|
165
|
-
await server.start({ onConnection });
|
|
166
|
-
connectionCallback = mockWebSocketServer.on.mock
|
|
167
|
-
.calls[0][1];
|
|
168
|
-
connectionCallback(mockWebSocket, {
|
|
169
|
-
headers: { origin: 'https://malicious.com' },
|
|
170
|
-
});
|
|
171
|
-
expect(onConnection).not.toHaveBeenCalled();
|
|
172
|
-
});
|
|
173
|
-
it('should call onMessage when a valid message is received', async () => {
|
|
174
|
-
const onMessage = vi.fn().mockReturnValue(true);
|
|
175
|
-
await server.start({ onMessage });
|
|
176
|
-
connectionCallback = mockWebSocketServer.on.mock
|
|
177
|
-
.calls[0][1];
|
|
178
|
-
connectionCallback(mockWebSocket, {
|
|
179
|
-
headers: { origin: 'https://app.hubspot.com' },
|
|
180
|
-
});
|
|
181
|
-
const messageCallback = mockWebSocket.on.mock.calls.find(call => call[0] === 'message')[1];
|
|
182
|
-
messageCallback(JSON.stringify({ type: 'test:action', data: { key: 'value' } }));
|
|
183
|
-
expect(onMessage).toHaveBeenCalledWith(mockWebSocket, {
|
|
184
|
-
type: 'test:action',
|
|
185
|
-
data: { key: 'value' },
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
it('should log error when onMessage returns false', async () => {
|
|
189
|
-
const onMessage = vi.fn().mockReturnValue(false);
|
|
190
|
-
await server.start({ onMessage });
|
|
191
|
-
connectionCallback = mockWebSocketServer.on.mock
|
|
192
|
-
.calls[0][1];
|
|
193
|
-
connectionCallback(mockWebSocket, {
|
|
194
|
-
headers: { origin: 'https://app.hubspot.com' },
|
|
195
|
-
});
|
|
196
|
-
const messageCallback = mockWebSocket.on.mock.calls.find(call => call[0] === 'message')[1];
|
|
197
|
-
messageCallback(JSON.stringify({ type: 'UNKNOWN_TYPE' }));
|
|
198
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining('UNKNOWN_TYPE'));
|
|
199
|
-
});
|
|
200
|
-
it('should call onClose when server closes', async () => {
|
|
201
|
-
const onClose = vi.fn();
|
|
202
|
-
await server.start({ onClose });
|
|
203
|
-
const closeCallback = mockWebSocketServer.on.mock.calls.find(call => call[0] === 'close')[1];
|
|
204
|
-
closeCallback();
|
|
205
|
-
expect(onClose).toHaveBeenCalled();
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
describe('message parsing', () => {
|
|
209
|
-
let messageCallback;
|
|
210
|
-
beforeEach(async () => {
|
|
211
|
-
isPortManagerServerRunning.mockResolvedValue(true);
|
|
212
|
-
requestPorts.mockResolvedValue({
|
|
213
|
-
[INSTANCE_ID]: PORT,
|
|
214
|
-
});
|
|
215
|
-
await server.start({});
|
|
216
|
-
const connectionCallback = mockWebSocketServer.on.mock.calls[0][1];
|
|
217
|
-
connectionCallback(mockWebSocket, {
|
|
218
|
-
headers: { origin: 'https://app.hubspot.com' },
|
|
219
|
-
});
|
|
220
|
-
messageCallback = mockWebSocket.on.mock.calls.find(call => call[0] === 'message')[1];
|
|
221
|
-
});
|
|
222
|
-
it('should log error for messages missing a type field', () => {
|
|
223
|
-
messageCallback(JSON.stringify({}));
|
|
224
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining('Missing type field'));
|
|
225
|
-
});
|
|
226
|
-
it('should log error for invalid JSON', () => {
|
|
227
|
-
messageCallback('not valid json');
|
|
228
|
-
expect(uiLogger.error).toHaveBeenCalledWith(expect.stringContaining('Invalid JSON'));
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
describe('sendMessage()', () => {
|
|
232
|
-
it('should serialize and send a message to the websocket', () => {
|
|
233
|
-
const message = { type: 'test:message', data: { foo: 'bar' } };
|
|
234
|
-
server.sendMessage(mockWebSocket, message);
|
|
235
|
-
expect(mockWebSocket.send).toHaveBeenCalledWith(JSON.stringify(message));
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
describe('shutdown()', () => {
|
|
239
|
-
it('should close the websocket server', async () => {
|
|
240
|
-
isPortManagerServerRunning.mockResolvedValue(true);
|
|
241
|
-
requestPorts.mockResolvedValue({
|
|
242
|
-
[INSTANCE_ID]: PORT,
|
|
243
|
-
});
|
|
244
|
-
await server.start({});
|
|
245
|
-
server.shutdown();
|
|
246
|
-
expect(mockWebSocketServer.close).toHaveBeenCalled();
|
|
247
|
-
});
|
|
248
|
-
it('should handle shutdown when server was never started', () => {
|
|
249
|
-
expect(() => server.shutdown()).not.toThrow();
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { updateConfigAccount, createEmptyConfigFile, getConfigFilePath, localConfigFileExists, globalConfigFileExists, setConfigAccountAsDefault, } from '@hubspot/local-dev-lib/config';
|
|
2
|
-
import { getAccessToken, updateConfigWithAccessToken, } from '@hubspot/local-dev-lib/personalAccessKey';
|
|
3
|
-
import { toKebabCase } from '@hubspot/local-dev-lib/text';
|
|
4
|
-
import { PERSONAL_ACCESS_KEY_AUTH_METHOD } from '@hubspot/local-dev-lib/constants/auth';
|
|
5
|
-
import { handleMerge, handleMigration } from '../configMigrate.js';
|
|
6
|
-
import { personalAccessKeyPrompt } from '../prompts/personalAccessKeyPrompt.js';
|
|
7
|
-
import { cliAccountNamePrompt } from '../prompts/accountNamePrompt.js';
|
|
8
|
-
import { setAsDefaultAccountPrompt } from '../prompts/setAsDefaultAccountPrompt.js';
|
|
9
|
-
import { authenticateNewAccount } from '../accountAuth.js';
|
|
10
|
-
vi.mock('@hubspot/local-dev-lib/config');
|
|
11
|
-
vi.mock('@hubspot/local-dev-lib/personalAccessKey');
|
|
12
|
-
vi.mock('@hubspot/local-dev-lib/text');
|
|
13
|
-
vi.mock('../configMigrate.js');
|
|
14
|
-
vi.mock('../errorHandlers/index.js');
|
|
15
|
-
vi.mock('../prompts/personalAccessKeyPrompt.js');
|
|
16
|
-
vi.mock('../prompts/accountNamePrompt.js');
|
|
17
|
-
vi.mock('../prompts/setAsDefaultAccountPrompt.js');
|
|
18
|
-
vi.mock('../ui/logger.js', () => ({
|
|
19
|
-
uiLogger: {
|
|
20
|
-
log: vi.fn(),
|
|
21
|
-
error: vi.fn(),
|
|
22
|
-
success: vi.fn(),
|
|
23
|
-
},
|
|
24
|
-
}));
|
|
25
|
-
const mockedUpdateConfigAccount = updateConfigAccount;
|
|
26
|
-
const mockedCreateEmptyConfigFile = createEmptyConfigFile;
|
|
27
|
-
const mockedGetConfigFilePath = getConfigFilePath;
|
|
28
|
-
const mockedLocalConfigFileExists = localConfigFileExists;
|
|
29
|
-
const mockedGlobalConfigFileExists = globalConfigFileExists;
|
|
30
|
-
const mockedSetConfigAccountAsDefault = setConfigAccountAsDefault;
|
|
31
|
-
const mockedGetAccessToken = getAccessToken;
|
|
32
|
-
const mockedUpdateConfigWithAccessToken = updateConfigWithAccessToken;
|
|
33
|
-
const mockedToKebabCase = toKebabCase;
|
|
34
|
-
const mockedHandleMerge = handleMerge;
|
|
35
|
-
const mockedHandleMigration = handleMigration;
|
|
36
|
-
const mockedPersonalAccessKeyPrompt = personalAccessKeyPrompt;
|
|
37
|
-
const mockedCliAccountNamePrompt = cliAccountNamePrompt;
|
|
38
|
-
const mockedSetAsDefaultAccountPrompt = setAsDefaultAccountPrompt;
|
|
39
|
-
describe('lib/accountAuth', () => {
|
|
40
|
-
describe('authenticateNewAccount()', () => {
|
|
41
|
-
const mockAccessToken = {
|
|
42
|
-
portalId: 123456,
|
|
43
|
-
accessToken: 'test-token',
|
|
44
|
-
expiresAt: '2025-01-01',
|
|
45
|
-
scopeGroups: ['test-scope'],
|
|
46
|
-
enabledFeatures: { 'test-feature': 1 },
|
|
47
|
-
encodedOAuthRefreshToken: 'test-refresh-token',
|
|
48
|
-
hubName: 'Test Hub',
|
|
49
|
-
accountType: 'STANDARD',
|
|
50
|
-
};
|
|
51
|
-
const mockAccountConfig = {
|
|
52
|
-
name: 'test-hub',
|
|
53
|
-
accountId: 123456,
|
|
54
|
-
env: 'prod',
|
|
55
|
-
accountType: 'STANDARD',
|
|
56
|
-
authType: PERSONAL_ACCESS_KEY_AUTH_METHOD.value,
|
|
57
|
-
personalAccessKey: 'test-key',
|
|
58
|
-
auth: {
|
|
59
|
-
tokenInfo: {
|
|
60
|
-
accessToken: 'test-token',
|
|
61
|
-
expiresAt: '2025-01-01',
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
beforeEach(() => {
|
|
66
|
-
vi.clearAllMocks();
|
|
67
|
-
mockedLocalConfigFileExists.mockReturnValue(false);
|
|
68
|
-
mockedGlobalConfigFileExists.mockReturnValue(false);
|
|
69
|
-
mockedGetAccessToken.mockResolvedValue(mockAccessToken);
|
|
70
|
-
mockedUpdateConfigWithAccessToken.mockResolvedValue(mockAccountConfig);
|
|
71
|
-
mockedToKebabCase.mockReturnValue('test-hub');
|
|
72
|
-
mockedCliAccountNamePrompt.mockResolvedValue({ name: 'test-hub' });
|
|
73
|
-
mockedGetConfigFilePath.mockReturnValue('/path/to/config');
|
|
74
|
-
mockedPersonalAccessKeyPrompt.mockResolvedValue({
|
|
75
|
-
personalAccessKey: 'test-key',
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
it('should create config file if it does not exist', async () => {
|
|
79
|
-
mockedGlobalConfigFileExists.mockReturnValue(false);
|
|
80
|
-
await authenticateNewAccount({
|
|
81
|
-
env: 'prod',
|
|
82
|
-
providedPersonalAccessKey: 'test-key',
|
|
83
|
-
accountId: 123456,
|
|
84
|
-
});
|
|
85
|
-
expect(mockedCreateEmptyConfigFile).toHaveBeenCalledWith(true);
|
|
86
|
-
});
|
|
87
|
-
it('should not create config file if it already exists', async () => {
|
|
88
|
-
mockedGlobalConfigFileExists.mockReturnValue(true);
|
|
89
|
-
await authenticateNewAccount({
|
|
90
|
-
env: 'prod',
|
|
91
|
-
providedPersonalAccessKey: 'test-key',
|
|
92
|
-
accountId: 123456,
|
|
93
|
-
});
|
|
94
|
-
expect(mockedCreateEmptyConfigFile).not.toHaveBeenCalled();
|
|
95
|
-
});
|
|
96
|
-
it('should use provided personal access key without prompting', async () => {
|
|
97
|
-
await authenticateNewAccount({
|
|
98
|
-
env: 'prod',
|
|
99
|
-
providedPersonalAccessKey: 'test-key',
|
|
100
|
-
accountId: 123456,
|
|
101
|
-
});
|
|
102
|
-
expect(mockedPersonalAccessKeyPrompt).not.toHaveBeenCalled();
|
|
103
|
-
expect(mockedGetAccessToken).toHaveBeenCalledWith('test-key', 'prod');
|
|
104
|
-
});
|
|
105
|
-
it('should prompt for personal access key if not provided', async () => {
|
|
106
|
-
await authenticateNewAccount({
|
|
107
|
-
env: 'prod',
|
|
108
|
-
accountId: 123456,
|
|
109
|
-
});
|
|
110
|
-
expect(mockedPersonalAccessKeyPrompt).toHaveBeenCalledWith({
|
|
111
|
-
env: 'prod',
|
|
112
|
-
account: 123456,
|
|
113
|
-
});
|
|
114
|
-
expect(mockedGetAccessToken).toHaveBeenCalledWith('test-key', 'prod');
|
|
115
|
-
});
|
|
116
|
-
it('should prompt for account name if config does not exist', async () => {
|
|
117
|
-
mockedGlobalConfigFileExists.mockReturnValue(false);
|
|
118
|
-
await authenticateNewAccount({
|
|
119
|
-
env: 'prod',
|
|
120
|
-
providedPersonalAccessKey: 'test-key',
|
|
121
|
-
accountId: 123456,
|
|
122
|
-
});
|
|
123
|
-
expect(mockedCliAccountNamePrompt).toHaveBeenCalledWith('test-hub');
|
|
124
|
-
});
|
|
125
|
-
it('should not prompt for account name if config already exists', async () => {
|
|
126
|
-
mockedGlobalConfigFileExists.mockReturnValue(true);
|
|
127
|
-
await authenticateNewAccount({
|
|
128
|
-
env: 'prod',
|
|
129
|
-
providedPersonalAccessKey: 'test-key',
|
|
130
|
-
accountId: 123456,
|
|
131
|
-
});
|
|
132
|
-
expect(mockedCliAccountNamePrompt).not.toHaveBeenCalled();
|
|
133
|
-
});
|
|
134
|
-
it('should set account as default when setAsDefaultAccount is true', async () => {
|
|
135
|
-
mockedGlobalConfigFileExists.mockReturnValue(true);
|
|
136
|
-
await authenticateNewAccount({
|
|
137
|
-
env: 'prod',
|
|
138
|
-
providedPersonalAccessKey: 'test-key',
|
|
139
|
-
accountId: 123456,
|
|
140
|
-
setAsDefaultAccount: true,
|
|
141
|
-
});
|
|
142
|
-
expect(mockedSetConfigAccountAsDefault).toHaveBeenCalledWith('test-hub');
|
|
143
|
-
});
|
|
144
|
-
it('should prompt to set as default when setAsDefaultAccount is not provided and config exists', async () => {
|
|
145
|
-
mockedGlobalConfigFileExists.mockReturnValue(true);
|
|
146
|
-
await authenticateNewAccount({
|
|
147
|
-
env: 'prod',
|
|
148
|
-
providedPersonalAccessKey: 'test-key',
|
|
149
|
-
accountId: 123456,
|
|
150
|
-
});
|
|
151
|
-
expect(mockedSetAsDefaultAccountPrompt).toHaveBeenCalledWith('test-hub');
|
|
152
|
-
});
|
|
153
|
-
it('should return the updated account config on success', async () => {
|
|
154
|
-
const result = await authenticateNewAccount({
|
|
155
|
-
env: 'prod',
|
|
156
|
-
providedPersonalAccessKey: 'test-key',
|
|
157
|
-
accountId: 123456,
|
|
158
|
-
});
|
|
159
|
-
expect(result).toEqual(mockAccountConfig);
|
|
160
|
-
});
|
|
161
|
-
it('should return null if access token fetch fails', async () => {
|
|
162
|
-
mockedGetAccessToken.mockRejectedValue(new Error('Invalid token'));
|
|
163
|
-
const result = await authenticateNewAccount({
|
|
164
|
-
env: 'prod',
|
|
165
|
-
providedPersonalAccessKey: 'test-key',
|
|
166
|
-
accountId: 123456,
|
|
167
|
-
});
|
|
168
|
-
expect(result).toBeNull();
|
|
169
|
-
});
|
|
170
|
-
it('should return null if config update fails', async () => {
|
|
171
|
-
mockedUpdateConfigWithAccessToken.mockResolvedValue(null);
|
|
172
|
-
const result = await authenticateNewAccount({
|
|
173
|
-
env: 'prod',
|
|
174
|
-
providedPersonalAccessKey: 'test-key',
|
|
175
|
-
accountId: 123456,
|
|
176
|
-
});
|
|
177
|
-
expect(result).toBeNull();
|
|
178
|
-
});
|
|
179
|
-
it('should handle missing account name and prompt for it', async () => {
|
|
180
|
-
mockedGlobalConfigFileExists.mockReturnValue(true);
|
|
181
|
-
mockedUpdateConfigWithAccessToken.mockResolvedValue({
|
|
182
|
-
...mockAccountConfig,
|
|
183
|
-
name: undefined,
|
|
184
|
-
});
|
|
185
|
-
mockedCliAccountNamePrompt.mockResolvedValue({
|
|
186
|
-
name: 'new-account-name',
|
|
187
|
-
});
|
|
188
|
-
await authenticateNewAccount({
|
|
189
|
-
env: 'prod',
|
|
190
|
-
providedPersonalAccessKey: 'test-key',
|
|
191
|
-
accountId: 123456,
|
|
192
|
-
});
|
|
193
|
-
expect(mockedCliAccountNamePrompt).toHaveBeenCalledWith('test-hub');
|
|
194
|
-
expect(mockedUpdateConfigAccount).toHaveBeenCalledWith(expect.objectContaining({
|
|
195
|
-
name: 'new-account-name',
|
|
196
|
-
}));
|
|
197
|
-
});
|
|
198
|
-
describe('config migration', () => {
|
|
199
|
-
it('should handle migration when local config exists and global does not', async () => {
|
|
200
|
-
mockedLocalConfigFileExists.mockReturnValue(true);
|
|
201
|
-
mockedGlobalConfigFileExists.mockReturnValue(false);
|
|
202
|
-
mockedHandleMigration.mockResolvedValue(true);
|
|
203
|
-
await authenticateNewAccount({
|
|
204
|
-
env: 'prod',
|
|
205
|
-
providedPersonalAccessKey: 'test-key',
|
|
206
|
-
accountId: 123456,
|
|
207
|
-
});
|
|
208
|
-
expect(mockedHandleMigration).toHaveBeenCalled();
|
|
209
|
-
expect(mockedHandleMerge).not.toHaveBeenCalled();
|
|
210
|
-
});
|
|
211
|
-
it('should handle merge when both local and global configs exist', async () => {
|
|
212
|
-
mockedLocalConfigFileExists.mockReturnValue(true);
|
|
213
|
-
mockedGlobalConfigFileExists.mockReturnValue(true);
|
|
214
|
-
mockedHandleMerge.mockResolvedValue(true);
|
|
215
|
-
await authenticateNewAccount({
|
|
216
|
-
env: 'prod',
|
|
217
|
-
providedPersonalAccessKey: 'test-key',
|
|
218
|
-
accountId: 123456,
|
|
219
|
-
});
|
|
220
|
-
expect(mockedHandleMerge).toHaveBeenCalled();
|
|
221
|
-
expect(mockedHandleMigration).not.toHaveBeenCalled();
|
|
222
|
-
});
|
|
223
|
-
it('should return null if migration is not confirmed', async () => {
|
|
224
|
-
mockedLocalConfigFileExists.mockReturnValue(true);
|
|
225
|
-
mockedGlobalConfigFileExists.mockReturnValue(false);
|
|
226
|
-
mockedHandleMigration.mockResolvedValue(false);
|
|
227
|
-
const result = await authenticateNewAccount({
|
|
228
|
-
env: 'prod',
|
|
229
|
-
providedPersonalAccessKey: 'test-key',
|
|
230
|
-
accountId: 123456,
|
|
231
|
-
});
|
|
232
|
-
expect(result).toBeNull();
|
|
233
|
-
});
|
|
234
|
-
it('should return null if merge is not confirmed', async () => {
|
|
235
|
-
mockedLocalConfigFileExists.mockReturnValue(true);
|
|
236
|
-
mockedGlobalConfigFileExists.mockReturnValue(true);
|
|
237
|
-
mockedHandleMerge.mockResolvedValue(false);
|
|
238
|
-
const result = await authenticateNewAccount({
|
|
239
|
-
env: 'prod',
|
|
240
|
-
providedPersonalAccessKey: 'test-key',
|
|
241
|
-
accountId: 123456,
|
|
242
|
-
});
|
|
243
|
-
expect(result).toBeNull();
|
|
244
|
-
});
|
|
245
|
-
it('should return null if migration throws error', async () => {
|
|
246
|
-
mockedLocalConfigFileExists.mockReturnValue(true);
|
|
247
|
-
mockedGlobalConfigFileExists.mockReturnValue(false);
|
|
248
|
-
mockedHandleMigration.mockRejectedValue(new Error('Migration failed'));
|
|
249
|
-
const result = await authenticateNewAccount({
|
|
250
|
-
env: 'prod',
|
|
251
|
-
providedPersonalAccessKey: 'test-key',
|
|
252
|
-
accountId: 123456,
|
|
253
|
-
});
|
|
254
|
-
expect(result).toBeNull();
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|