@hubspot/cli 7.7.19-experimental.3 → 7.7.20-experimental.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/api/__tests__/migrate.test.d.ts +1 -0
- package/api/__tests__/migrate.test.js +183 -0
- package/commands/__tests__/account.test.d.ts +1 -0
- package/commands/__tests__/account.test.js +74 -0
- package/commands/__tests__/auth.test.d.ts +1 -0
- package/commands/__tests__/auth.test.js +43 -0
- package/commands/__tests__/cms.test.d.ts +1 -0
- package/commands/__tests__/cms.test.js +49 -0
- package/commands/__tests__/config.test.d.ts +1 -0
- package/commands/__tests__/config.test.js +49 -0
- package/commands/__tests__/create.test.d.ts +1 -0
- package/commands/__tests__/create.test.js +38 -0
- package/commands/__tests__/customObject.test.d.ts +1 -0
- package/commands/__tests__/customObject.test.js +54 -0
- package/commands/__tests__/doctor.test.d.ts +1 -0
- package/commands/__tests__/doctor.test.js +139 -0
- package/commands/__tests__/feedback.test.d.ts +1 -0
- package/commands/__tests__/feedback.test.js +62 -0
- package/commands/__tests__/fetch.test.d.ts +1 -0
- package/commands/__tests__/fetch.test.js +56 -0
- package/commands/__tests__/filemanager.test.d.ts +1 -0
- package/commands/__tests__/filemanager.test.js +50 -0
- package/commands/__tests__/function.test.d.ts +1 -0
- package/commands/__tests__/function.test.js +51 -0
- package/commands/__tests__/getStarted.test.d.ts +1 -0
- package/commands/__tests__/getStarted.test.js +170 -0
- package/commands/__tests__/hubdb.test.d.ts +1 -0
- package/commands/__tests__/hubdb.test.js +55 -0
- package/commands/__tests__/init.test.d.ts +1 -0
- package/commands/__tests__/init.test.js +47 -0
- package/commands/__tests__/lint.test.d.ts +1 -0
- package/commands/__tests__/lint.test.js +38 -0
- package/commands/__tests__/list.test.d.ts +1 -0
- package/commands/__tests__/list.test.js +47 -0
- package/commands/__tests__/logs.test.d.ts +1 -0
- package/commands/__tests__/logs.test.js +70 -0
- package/commands/__tests__/mcp.test.d.ts +1 -0
- package/commands/__tests__/mcp.test.js +51 -0
- package/commands/__tests__/mv.test.d.ts +1 -0
- package/commands/__tests__/mv.test.js +84 -0
- package/commands/__tests__/open.test.d.ts +1 -0
- package/commands/__tests__/open.test.js +96 -0
- package/commands/__tests__/project.test.d.ts +1 -0
- package/commands/__tests__/project.test.js +100 -0
- package/commands/__tests__/remove.test.d.ts +1 -0
- package/commands/__tests__/remove.test.js +77 -0
- package/commands/__tests__/sandbox.test.d.ts +1 -0
- package/commands/__tests__/sandbox.test.js +49 -0
- package/commands/__tests__/secret.test.d.ts +1 -0
- package/commands/__tests__/secret.test.js +54 -0
- package/commands/__tests__/testAccount.test.d.ts +1 -0
- package/commands/__tests__/testAccount.test.js +60 -0
- package/commands/__tests__/theme.test.d.ts +1 -0
- package/commands/__tests__/theme.test.js +52 -0
- package/commands/account/__tests__/auth.test.d.ts +1 -0
- package/commands/account/__tests__/auth.test.js +31 -0
- package/commands/account/__tests__/clean.test.d.ts +1 -0
- package/commands/account/__tests__/clean.test.js +33 -0
- package/commands/account/__tests__/createOverride.test.d.ts +1 -0
- package/commands/account/__tests__/createOverride.test.js +37 -0
- package/commands/account/__tests__/info.test.d.ts +1 -0
- package/commands/account/__tests__/info.test.js +33 -0
- package/commands/account/__tests__/list.test.d.ts +1 -0
- package/commands/account/__tests__/list.test.js +33 -0
- package/commands/account/__tests__/remove.test.d.ts +1 -0
- package/commands/account/__tests__/remove.test.js +41 -0
- package/commands/account/__tests__/removeOverride.d.ts +1 -0
- package/commands/account/__tests__/removeOverride.js +30 -0
- package/commands/account/__tests__/rename.test.d.ts +1 -0
- package/commands/account/__tests__/rename.test.js +47 -0
- package/commands/account/__tests__/use.test.d.ts +1 -0
- package/commands/account/__tests__/use.test.js +37 -0
- package/commands/app/__tests__/migrate.test.d.ts +1 -0
- package/commands/app/__tests__/migrate.test.js +129 -0
- package/commands/app/secret/__tests__/add.test.d.ts +1 -0
- package/commands/app/secret/__tests__/add.test.js +33 -0
- package/commands/app/secret/__tests__/delete.test.d.ts +1 -0
- package/commands/app/secret/__tests__/delete.test.js +33 -0
- package/commands/app/secret/__tests__/list.test.d.ts +1 -0
- package/commands/app/secret/__tests__/list.test.js +30 -0
- package/commands/app/secret/__tests__/update.test.d.ts +1 -0
- package/commands/app/secret/__tests__/update.test.js +33 -0
- package/commands/app.js +1 -6
- package/commands/customObject/__tests__/create.test.d.ts +1 -0
- package/commands/customObject/__tests__/create.test.js +45 -0
- package/commands/customObject/__tests__/schema.test.d.ts +1 -0
- package/commands/customObject/__tests__/schema.test.js +58 -0
- package/commands/customObject/schema/__tests__/create.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/create.test.js +33 -0
- package/commands/customObject/schema/__tests__/delete.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/delete.test.js +47 -0
- package/commands/customObject/schema/__tests__/fetch-all.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/fetch-all.test.js +46 -0
- package/commands/customObject/schema/__tests__/fetch.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/fetch.test.js +50 -0
- package/commands/customObject/schema/__tests__/list.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/list.test.js +34 -0
- package/commands/customObject/schema/__tests__/update.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/update.test.js +45 -0
- package/commands/fetch.js +0 -1
- package/commands/filemanager/__tests__/fetch.test.d.ts +1 -0
- package/commands/filemanager/__tests__/fetch.test.js +37 -0
- package/commands/filemanager/__tests__/upload.test.d.ts +1 -0
- package/commands/filemanager/__tests__/upload.test.js +35 -0
- package/commands/hubdb/__tests__/clear.test.d.ts +1 -0
- package/commands/hubdb/__tests__/clear.test.js +33 -0
- package/commands/hubdb/__tests__/create.test.d.ts +1 -0
- package/commands/hubdb/__tests__/create.test.js +33 -0
- package/commands/hubdb/__tests__/delete.test.d.ts +1 -0
- package/commands/hubdb/__tests__/delete.test.js +33 -0
- package/commands/hubdb/__tests__/fetch.test.d.ts +1 -0
- package/commands/hubdb/__tests__/fetch.test.js +33 -0
- package/commands/hubdb/__tests__/list.test.d.ts +1 -0
- package/commands/hubdb/__tests__/list.test.js +101 -0
- package/commands/logs.js +0 -1
- package/commands/mcp/__tests__/setup.test.d.ts +1 -0
- package/commands/mcp/__tests__/setup.test.js +31 -0
- package/commands/mcp/__tests__/start.test.d.ts +1 -0
- package/commands/mcp/__tests__/start.test.js +32 -0
- package/commands/project/__tests__/add.test.d.ts +1 -0
- package/commands/project/__tests__/add.test.js +48 -0
- package/commands/project/__tests__/create.test.d.ts +1 -0
- package/commands/project/__tests__/create.test.js +45 -0
- package/commands/project/__tests__/deploy.test.d.ts +1 -0
- package/commands/project/__tests__/deploy.test.js +344 -0
- package/commands/project/__tests__/devUnifiedFlow.test.d.ts +1 -0
- package/commands/project/__tests__/devUnifiedFlow.test.js +419 -0
- package/commands/project/__tests__/download.test.d.ts +1 -0
- package/commands/project/__tests__/download.test.js +44 -0
- package/commands/project/__tests__/fixtures/exampleProject.json +33 -0
- package/commands/project/__tests__/installDeps.test.d.ts +1 -0
- package/commands/project/__tests__/installDeps.test.js +180 -0
- package/commands/project/__tests__/listBuilds.test.d.ts +1 -0
- package/commands/project/__tests__/listBuilds.test.js +43 -0
- package/commands/project/__tests__/logs.test.d.ts +1 -0
- package/commands/project/__tests__/logs.test.js +246 -0
- package/commands/project/__tests__/migrate.test.d.ts +1 -0
- package/commands/project/__tests__/migrate.test.js +116 -0
- package/commands/project/__tests__/migrateApp.test.d.ts +1 -0
- package/commands/project/__tests__/migrateApp.test.js +87 -0
- package/commands/project/__tests__/open.test.d.ts +1 -0
- package/commands/project/__tests__/open.test.js +44 -0
- package/commands/project/__tests__/profile.test.d.ts +1 -0
- package/commands/project/__tests__/profile.test.js +47 -0
- package/commands/project/__tests__/upload.test.d.ts +1 -0
- package/commands/project/__tests__/upload.test.js +48 -0
- package/commands/project/__tests__/watch.test.d.ts +1 -0
- package/commands/project/__tests__/watch.test.js +40 -0
- package/commands/project/dev/unifiedFlow.js +1 -1
- package/commands/sandbox/__tests__/create.test.d.ts +1 -0
- package/commands/sandbox/__tests__/create.test.js +36 -0
- package/commands/sandbox/__tests__/delete.test.d.ts +1 -0
- package/commands/sandbox/__tests__/delete.test.js +36 -0
- package/commands/secret/__tests__/addSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/addSecret.test.js +34 -0
- package/commands/secret/__tests__/deleteSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/deleteSecret.test.js +46 -0
- package/commands/secret/__tests__/listSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/listSecret.test.js +34 -0
- package/commands/secret/__tests__/updateSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/updateSecret.test.js +34 -0
- package/commands/testAccount/__tests__/create.test.d.ts +1 -0
- package/commands/testAccount/__tests__/create.test.js +38 -0
- package/commands/testAccount/__tests__/createConfig.test.d.ts +1 -0
- package/commands/testAccount/__tests__/createConfig.test.js +40 -0
- package/commands/testAccount/__tests__/delete.test.d.ts +1 -0
- package/commands/testAccount/__tests__/delete.test.js +36 -0
- package/commands/testAccount/create.js +24 -14
- package/commands/theme/__tests__/generate-selectors.test.d.ts +1 -0
- package/commands/theme/__tests__/generate-selectors.test.js +33 -0
- package/commands/theme/__tests__/marketplace-validate.test.d.ts +1 -0
- package/commands/theme/__tests__/marketplace-validate.test.js +41 -0
- package/commands/theme/__tests__/preview.test.d.ts +1 -0
- package/commands/theme/__tests__/preview.test.js +65 -0
- package/lang/en.d.ts +6 -65
- package/lang/en.js +6 -65
- package/lib/__tests__/accountTypes.test.d.ts +1 -0
- package/lib/__tests__/accountTypes.test.js +100 -0
- package/lib/__tests__/buildAccount.test.d.ts +1 -0
- package/lib/__tests__/buildAccount.test.js +231 -0
- package/lib/__tests__/commonOpts.test.d.ts +1 -0
- package/lib/__tests__/commonOpts.test.js +87 -0
- package/lib/__tests__/dependencyManagement.test.d.ts +1 -0
- package/lib/__tests__/dependencyManagement.test.js +180 -0
- package/lib/__tests__/developerTestAccounts.test.d.ts +1 -0
- package/lib/__tests__/developerTestAccounts.test.js +180 -0
- package/lib/__tests__/hasFeature.test.d.ts +1 -0
- package/lib/__tests__/hasFeature.test.js +37 -0
- package/lib/__tests__/npm.test.d.ts +1 -0
- package/lib/__tests__/npm.test.js +62 -0
- package/lib/__tests__/oauth.test.d.ts +1 -0
- package/lib/__tests__/oauth.test.js +113 -0
- package/lib/__tests__/parsing.test.d.ts +1 -0
- package/lib/__tests__/parsing.test.js +36 -0
- package/lib/__tests__/polling.test.d.ts +1 -0
- package/lib/__tests__/polling.test.js +78 -0
- package/lib/__tests__/process.test.d.ts +1 -0
- package/lib/__tests__/process.test.js +90 -0
- package/lib/__tests__/projectProfiles.test.d.ts +1 -0
- package/lib/__tests__/projectProfiles.test.js +134 -0
- package/lib/__tests__/sandboxSync.test.d.ts +1 -0
- package/lib/__tests__/sandboxSync.test.js +131 -0
- package/lib/__tests__/sandboxes.test.d.ts +1 -0
- package/lib/__tests__/sandboxes.test.js +148 -0
- package/lib/__tests__/serverlessLogs.test.d.ts +1 -0
- package/lib/__tests__/serverlessLogs.test.js +154 -0
- package/lib/__tests__/usageTracking.test.d.ts +1 -0
- package/lib/__tests__/usageTracking.test.js +171 -0
- package/lib/__tests__/validation.test.d.ts +1 -0
- package/lib/__tests__/validation.test.js +145 -0
- package/lib/__tests__/yargsUtils.test.d.ts +1 -0
- package/lib/__tests__/yargsUtils.test.js +74 -0
- package/lib/app/__tests__/migrate.test.d.ts +1 -0
- package/lib/app/__tests__/migrate.test.js +495 -0
- package/lib/app/__tests__/migrate_legacy.test.d.ts +1 -0
- package/lib/app/__tests__/migrate_legacy.test.js +136 -0
- package/lib/buildAccount.d.ts +1 -7
- package/lib/buildAccount.js +4 -54
- package/lib/doctor/Diagnosis.js +11 -11
- package/lib/doctor/Doctor.js +42 -42
- package/lib/doctor/__tests__/Diagnosis.test.d.ts +1 -0
- package/lib/doctor/__tests__/Diagnosis.test.js +87 -0
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.d.ts +1 -0
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +172 -0
- package/lib/doctor/__tests__/Doctor.test.d.ts +1 -0
- package/lib/doctor/__tests__/Doctor.test.js +398 -0
- package/lib/mcp/setup.js +18 -2
- package/lib/middleware/__test__/configMiddleware.test.js +12 -12
- package/lib/middleware/__test__/gitMiddleware.test.js +4 -4
- package/lib/middleware/__test__/notificationsMiddleware.test.js +2 -2
- package/lib/middleware/__test__/requestMiddleware.test.js +2 -2
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +7 -7
- package/lib/middleware/notificationsMiddleware.js +16 -13
- package/lib/projects/__tests__/AppDevModeInterface.test.d.ts +1 -0
- package/lib/projects/__tests__/AppDevModeInterface.test.js +517 -0
- package/lib/projects/__tests__/LocalDevProcess.test.d.ts +1 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +314 -0
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.d.ts +1 -0
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +175 -0
- package/lib/projects/__tests__/ProjectLogsManager.test.d.ts +1 -0
- package/lib/projects/__tests__/ProjectLogsManager.test.js +191 -0
- package/lib/projects/__tests__/buildAndDeploy.test.d.ts +1 -0
- package/lib/projects/__tests__/buildAndDeploy.test.js +25 -0
- package/lib/projects/__tests__/components.test.d.ts +1 -0
- package/lib/projects/__tests__/components.test.js +186 -0
- package/lib/projects/__tests__/projects.test.d.ts +1 -0
- package/lib/projects/__tests__/projects.test.js +89 -0
- package/lib/projects/__tests__/structure.test.d.ts +1 -0
- package/lib/projects/__tests__/structure.test.js +249 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.d.ts +1 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +206 -0
- package/lib/projects/add/__tests__/v3AddComponent.test.d.ts +1 -0
- package/lib/projects/add/__tests__/v3AddComponent.test.js +190 -0
- package/lib/projects/create/__tests__/legacy.test.d.ts +1 -0
- package/lib/projects/create/__tests__/legacy.test.js +126 -0
- package/lib/projects/create/__tests__/v3.test.d.ts +1 -0
- package/lib/projects/create/__tests__/v3.test.js +80 -0
- package/lib/projects/localDev/DevServerManager.js +0 -1
- package/lib/projects/localDev/helpers.d.ts +1 -1
- package/lib/projects/localDev/helpers.js +2 -2
- package/lib/projects/structure.d.ts +2 -2
- package/lib/projects/upload.d.ts +1 -2
- package/lib/projects/upload.js +0 -1
- package/lib/prompts/__tests__/downloadProjectPrompt.test.d.ts +1 -0
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +30 -0
- package/lib/prompts/__tests__/projectsLogsPrompt.test.d.ts +1 -0
- package/lib/prompts/__tests__/projectsLogsPrompt.test.js +42 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +10 -9
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +43 -81
- package/lib/schema.js +5 -1
- package/lib/ui/SpinniesManager.js +0 -1
- package/lib/ui/supportHyperlinks.js +2 -2
- package/lib/ui/supportsColor.js +2 -2
- package/lib/utils/hasFlag.d.ts +1 -0
- package/lib/utils/hasFlag.js +15 -0
- package/lib/yargsUtils.d.ts +2 -1
- package/lib/yargsUtils.js +3 -13
- package/mcp-server/tools/project/__tests__/AddFeatureToProject.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/AddFeatureToProject.test.js +152 -0
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +129 -0
- package/mcp-server/tools/project/__tests__/DeployProject.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/DeployProject.test.js +120 -0
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +127 -0
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +108 -0
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +111 -0
- package/mcp-server/utils/__tests__/command.test.d.ts +1 -0
- package/mcp-server/utils/__tests__/command.test.js +47 -0
- package/mcp-server/utils/__tests__/project.test.d.ts +1 -0
- package/mcp-server/utils/__tests__/project.test.js +81 -0
- package/package.json +8 -8
- package/commands/app/install.d.ts +0 -8
- package/commands/app/install.js +0 -127
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const config_1 = require("@hubspot/local-dev-lib/constants/config");
|
|
8
|
+
const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
|
|
9
|
+
const config_2 = require("@hubspot/local-dev-lib/config");
|
|
10
|
+
const environment_1 = require("@hubspot/local-dev-lib/environment");
|
|
11
|
+
const errorHandlers_1 = require("../../../lib/errorHandlers");
|
|
12
|
+
const ensureProjectExists_1 = require("../../../lib/projects/ensureProjectExists");
|
|
13
|
+
const helpers_1 = require("../../../lib/projects/localDev/helpers");
|
|
14
|
+
const projectDevTargetAccountPrompt_1 = require("../../../lib/prompts/projectDevTargetAccountPrompt");
|
|
15
|
+
const SpinniesManager_1 = __importDefault(require("../../../lib/ui/SpinniesManager"));
|
|
16
|
+
const LocalDevProcess_1 = __importDefault(require("../../../lib/projects/localDev/LocalDevProcess"));
|
|
17
|
+
const LocalDevWatcher_1 = __importDefault(require("../../../lib/projects/localDev/LocalDevWatcher"));
|
|
18
|
+
const LocalDevWebsocketServer_1 = __importDefault(require("../../../lib/projects/localDev/LocalDevWebsocketServer"));
|
|
19
|
+
const process_1 = require("../../../lib/process");
|
|
20
|
+
const accountTypes_1 = require("../../../lib/accountTypes");
|
|
21
|
+
const ui_1 = require("../../../lib/ui");
|
|
22
|
+
const logger_1 = require("../../../lib/ui/logger");
|
|
23
|
+
const en_1 = require("../../../lang/en");
|
|
24
|
+
const unifiedFlow_1 = require("../dev/unifiedFlow");
|
|
25
|
+
const environments_1 = require("@hubspot/local-dev-lib/constants/environments");
|
|
26
|
+
const vitest_1 = require("vitest");
|
|
27
|
+
// Mock @hubspot/ui-extensions-dev-server
|
|
28
|
+
vitest_1.vi.mock('@hubspot/ui-extensions-dev-server', () => ({
|
|
29
|
+
DevModeUnifiedInterface: {
|
|
30
|
+
setup: vitest_1.vi.fn().mockResolvedValue(undefined),
|
|
31
|
+
start: vitest_1.vi.fn().mockResolvedValue(undefined),
|
|
32
|
+
fileChange: vitest_1.vi.fn().mockResolvedValue(undefined),
|
|
33
|
+
cleanup: vitest_1.vi.fn().mockResolvedValue(undefined),
|
|
34
|
+
},
|
|
35
|
+
}));
|
|
36
|
+
// Mock all dependencies
|
|
37
|
+
vitest_1.vi.mock('@hubspot/project-parsing-lib');
|
|
38
|
+
vitest_1.vi.mock('@hubspot/local-dev-lib/config');
|
|
39
|
+
vitest_1.vi.mock('@hubspot/local-dev-lib/environment');
|
|
40
|
+
vitest_1.vi.mock('../../../lib/errorHandlers');
|
|
41
|
+
vitest_1.vi.mock('../../../lib/projects/ensureProjectExists');
|
|
42
|
+
vitest_1.vi.mock('../../../lib/projects/localDev/helpers');
|
|
43
|
+
vitest_1.vi.mock('../../../lib/prompts/projectDevTargetAccountPrompt');
|
|
44
|
+
vitest_1.vi.mock('../../../lib/ui/SpinniesManager');
|
|
45
|
+
vitest_1.vi.mock('../../../lib/projects/localDev/LocalDevProcess');
|
|
46
|
+
vitest_1.vi.mock('../../../lib/projects/localDev/LocalDevWatcher');
|
|
47
|
+
vitest_1.vi.mock('../../../lib/projects/localDev/LocalDevWebsocketServer');
|
|
48
|
+
vitest_1.vi.mock('../../../lib/process');
|
|
49
|
+
vitest_1.vi.mock('../../../lib/accountTypes');
|
|
50
|
+
vitest_1.vi.mock('../../../lib/ui');
|
|
51
|
+
vitest_1.vi.mock('../../../lib/ui/logger');
|
|
52
|
+
describe('unifiedProjectDevFlow', () => {
|
|
53
|
+
const mockArgs = {
|
|
54
|
+
profile: 'test-profile',
|
|
55
|
+
d: false,
|
|
56
|
+
debug: false,
|
|
57
|
+
derivedAccountId: 123,
|
|
58
|
+
userProvidedAccount: undefined,
|
|
59
|
+
testingAccount: undefined,
|
|
60
|
+
projectAccount: undefined,
|
|
61
|
+
_: [],
|
|
62
|
+
$0: 'hs',
|
|
63
|
+
};
|
|
64
|
+
const mockProjectConfig = {
|
|
65
|
+
name: 'test-project',
|
|
66
|
+
srcDir: 'src',
|
|
67
|
+
platformVersion: '1.0.0',
|
|
68
|
+
};
|
|
69
|
+
const mockProjectDir = '/test/project';
|
|
70
|
+
const mockTargetProjectAccountId = 123;
|
|
71
|
+
const mockProvidedTargetTestingAccountId = 456;
|
|
72
|
+
const mockProfileConfig = {
|
|
73
|
+
accountId: 789,
|
|
74
|
+
};
|
|
75
|
+
const mockAccountConfig = {
|
|
76
|
+
accountId: 123,
|
|
77
|
+
name: 'test-account',
|
|
78
|
+
accountType: config_1.HUBSPOT_ACCOUNT_TYPES.STANDARD,
|
|
79
|
+
};
|
|
80
|
+
const mockProject = {
|
|
81
|
+
id: 1,
|
|
82
|
+
name: 'test-project',
|
|
83
|
+
deployedBuild: {
|
|
84
|
+
buildId: 123,
|
|
85
|
+
status: 'SUCCESS',
|
|
86
|
+
},
|
|
87
|
+
sourceIntegration: null,
|
|
88
|
+
};
|
|
89
|
+
const mockProjectNodes = {
|
|
90
|
+
component1: {
|
|
91
|
+
uid: 'component1',
|
|
92
|
+
componentType: 'APP',
|
|
93
|
+
localDev: {
|
|
94
|
+
componentRoot: '/test/path',
|
|
95
|
+
componentConfigPath: '/test/path/config.json',
|
|
96
|
+
configUpdatedSinceLastUpload: false,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
const mockLocalDevProcess = {
|
|
101
|
+
start: vitest_1.vi.fn().mockResolvedValue(undefined),
|
|
102
|
+
stop: vitest_1.vi.fn().mockResolvedValue(undefined),
|
|
103
|
+
};
|
|
104
|
+
const mockLocalDevWatcher = {
|
|
105
|
+
start: vitest_1.vi.fn(),
|
|
106
|
+
stop: vitest_1.vi.fn().mockResolvedValue(undefined),
|
|
107
|
+
};
|
|
108
|
+
const mockWebsocketServer = {
|
|
109
|
+
start: vitest_1.vi.fn().mockResolvedValue(undefined),
|
|
110
|
+
shutdown: vitest_1.vi.fn().mockResolvedValue(undefined),
|
|
111
|
+
};
|
|
112
|
+
beforeEach(() => {
|
|
113
|
+
vitest_1.vi.clearAllMocks();
|
|
114
|
+
// Mock process.exit
|
|
115
|
+
vitest_1.vi.spyOn(global.process, 'exit').mockImplementation((code) => {
|
|
116
|
+
throw new Error(`Process.exit called with code ${code}`);
|
|
117
|
+
});
|
|
118
|
+
// Setup default mocks
|
|
119
|
+
environment_1.getValidEnv.mockReturnValue(environments_1.ENVIRONMENTS.PROD);
|
|
120
|
+
project_parsing_lib_1.translateForLocalDev.mockResolvedValue({
|
|
121
|
+
intermediateNodesIndexedByUid: mockProjectNodes,
|
|
122
|
+
});
|
|
123
|
+
config_2.getAccountConfig.mockReturnValue(mockAccountConfig);
|
|
124
|
+
config_2.getConfigAccounts.mockReturnValue([mockAccountConfig]);
|
|
125
|
+
accountTypes_1.isUnifiedAccount.mockResolvedValue(true);
|
|
126
|
+
accountTypes_1.isTestAccountOrSandbox.mockReturnValue(false);
|
|
127
|
+
ensureProjectExists_1.ensureProjectExists.mockResolvedValue({
|
|
128
|
+
projectExists: true,
|
|
129
|
+
project: mockProject,
|
|
130
|
+
});
|
|
131
|
+
SpinniesManager_1.default.init.mockImplementation(() => { });
|
|
132
|
+
LocalDevProcess_1.default.mockImplementation(() => mockLocalDevProcess);
|
|
133
|
+
LocalDevWatcher_1.default.mockImplementation(() => mockLocalDevWatcher);
|
|
134
|
+
LocalDevWebsocketServer_1.default.mockImplementation(() => mockWebsocketServer);
|
|
135
|
+
process_1.handleKeypress.mockImplementation(() => { });
|
|
136
|
+
process_1.handleExit.mockImplementation(() => { });
|
|
137
|
+
logger_1.uiLogger.debug.mockImplementation(() => { });
|
|
138
|
+
logger_1.uiLogger.error.mockImplementation(() => { });
|
|
139
|
+
logger_1.uiLogger.log.mockImplementation(() => { });
|
|
140
|
+
ui_1.uiLine.mockImplementation(() => { });
|
|
141
|
+
});
|
|
142
|
+
describe('successful flow', () => {
|
|
143
|
+
it('should complete successfully with existing project and provided testing account', async () => {
|
|
144
|
+
await (0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
145
|
+
args: mockArgs,
|
|
146
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
147
|
+
providedTargetTestingAccountId: mockProvidedTargetTestingAccountId,
|
|
148
|
+
projectConfig: mockProjectConfig,
|
|
149
|
+
projectDir: mockProjectDir,
|
|
150
|
+
});
|
|
151
|
+
expect(project_parsing_lib_1.translateForLocalDev).toHaveBeenCalledWith({
|
|
152
|
+
projectSourceDir: path_1.default.join(mockProjectDir, mockProjectConfig.srcDir),
|
|
153
|
+
platformVersion: mockProjectConfig.platformVersion,
|
|
154
|
+
accountId: mockTargetProjectAccountId,
|
|
155
|
+
}, { profile: mockArgs.profile });
|
|
156
|
+
expect(mockLocalDevProcess.start).toHaveBeenCalled();
|
|
157
|
+
expect(mockLocalDevWatcher.start).toHaveBeenCalled();
|
|
158
|
+
expect(mockWebsocketServer.start).toHaveBeenCalled();
|
|
159
|
+
});
|
|
160
|
+
it('should complete successfully with profile config', async () => {
|
|
161
|
+
await (0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
162
|
+
args: mockArgs,
|
|
163
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
164
|
+
projectConfig: mockProjectConfig,
|
|
165
|
+
projectDir: mockProjectDir,
|
|
166
|
+
profileConfig: mockProfileConfig,
|
|
167
|
+
});
|
|
168
|
+
expect(LocalDevProcess_1.default).toHaveBeenCalledWith(expect.objectContaining({
|
|
169
|
+
targetTestingAccountId: mockProfileConfig.accountId,
|
|
170
|
+
}));
|
|
171
|
+
});
|
|
172
|
+
it('should use target project account as testing account when it is a test account', async () => {
|
|
173
|
+
accountTypes_1.isTestAccountOrSandbox.mockReturnValue(true);
|
|
174
|
+
await (0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
175
|
+
args: mockArgs,
|
|
176
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
177
|
+
projectConfig: mockProjectConfig,
|
|
178
|
+
projectDir: mockProjectDir,
|
|
179
|
+
});
|
|
180
|
+
expect(LocalDevProcess_1.default).toHaveBeenCalledWith(expect.objectContaining({
|
|
181
|
+
targetTestingAccountId: mockTargetProjectAccountId,
|
|
182
|
+
}));
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
describe('error handling', () => {
|
|
186
|
+
it('should exit with error code when translation fails', async () => {
|
|
187
|
+
const translationError = new Error('Translation failed');
|
|
188
|
+
project_parsing_lib_1.translateForLocalDev.mockRejectedValue(translationError);
|
|
189
|
+
await expect((0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
190
|
+
args: mockArgs,
|
|
191
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
192
|
+
projectConfig: mockProjectConfig,
|
|
193
|
+
projectDir: mockProjectDir,
|
|
194
|
+
})).rejects.toThrow('Process.exit called with code 1');
|
|
195
|
+
expect(errorHandlers_1.logError).toHaveBeenCalledWith(translationError);
|
|
196
|
+
});
|
|
197
|
+
it('should exit with success when no runnable components found', async () => {
|
|
198
|
+
project_parsing_lib_1.translateForLocalDev.mockResolvedValue({
|
|
199
|
+
intermediateNodesIndexedByUid: {},
|
|
200
|
+
});
|
|
201
|
+
await expect((0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
202
|
+
args: mockArgs,
|
|
203
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
204
|
+
projectConfig: mockProjectConfig,
|
|
205
|
+
projectDir: mockProjectDir,
|
|
206
|
+
})).rejects.toThrow('Process.exit called with code 0');
|
|
207
|
+
expect(logger_1.uiLogger.error).toHaveBeenCalledWith(en_1.commands.project.dev.errors.noRunnableComponents);
|
|
208
|
+
});
|
|
209
|
+
it('should exit with error when account config not found', async () => {
|
|
210
|
+
config_2.getAccountConfig.mockReturnValue(null);
|
|
211
|
+
await expect((0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
212
|
+
args: mockArgs,
|
|
213
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
214
|
+
projectConfig: mockProjectConfig,
|
|
215
|
+
projectDir: mockProjectDir,
|
|
216
|
+
})).rejects.toThrow('Process.exit called with code 1');
|
|
217
|
+
expect(logger_1.uiLogger.error).toHaveBeenCalledWith(en_1.commands.project.dev.errors.noAccount(mockTargetProjectAccountId));
|
|
218
|
+
});
|
|
219
|
+
it('should exit with error when account is not combined and no profile', async () => {
|
|
220
|
+
accountTypes_1.isUnifiedAccount.mockResolvedValue(false);
|
|
221
|
+
await expect((0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
222
|
+
args: mockArgs,
|
|
223
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
224
|
+
projectConfig: mockProjectConfig,
|
|
225
|
+
projectDir: mockProjectDir,
|
|
226
|
+
})).rejects.toThrow('Process.exit called with code 1');
|
|
227
|
+
expect(logger_1.uiLogger.error).toHaveBeenCalledWith(en_1.commands.project.dev.errors.accountNotCombined);
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
describe('account type selection and prompting', () => {
|
|
231
|
+
beforeEach(() => {
|
|
232
|
+
// Reset to require prompting
|
|
233
|
+
accountTypes_1.isTestAccountOrSandbox.mockReturnValue(false);
|
|
234
|
+
});
|
|
235
|
+
it('should prompt for account type when no testing account provided', async () => {
|
|
236
|
+
helpers_1.selectAccountTypePrompt.mockResolvedValue(config_1.HUBSPOT_ACCOUNT_TYPES.DEVELOPER_TEST);
|
|
237
|
+
projectDevTargetAccountPrompt_1.selectDeveloperTestTargetAccountPrompt.mockResolvedValue({
|
|
238
|
+
targetAccountId: 456,
|
|
239
|
+
});
|
|
240
|
+
await (0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
241
|
+
args: mockArgs,
|
|
242
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
243
|
+
projectConfig: mockProjectConfig,
|
|
244
|
+
projectDir: mockProjectDir,
|
|
245
|
+
});
|
|
246
|
+
expect(helpers_1.selectAccountTypePrompt).toHaveBeenCalledWith(mockAccountConfig);
|
|
247
|
+
expect(projectDevTargetAccountPrompt_1.selectDeveloperTestTargetAccountPrompt).toHaveBeenCalled();
|
|
248
|
+
});
|
|
249
|
+
it('should handle developer test account creation', async () => {
|
|
250
|
+
helpers_1.selectAccountTypePrompt.mockResolvedValue(config_1.HUBSPOT_ACCOUNT_TYPES.DEVELOPER_TEST);
|
|
251
|
+
projectDevTargetAccountPrompt_1.selectDeveloperTestTargetAccountPrompt.mockResolvedValue({
|
|
252
|
+
createNestedAccount: true,
|
|
253
|
+
});
|
|
254
|
+
helpers_1.createDeveloperTestAccountForLocalDev.mockResolvedValue(999);
|
|
255
|
+
await (0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
256
|
+
args: mockArgs,
|
|
257
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
258
|
+
projectConfig: mockProjectConfig,
|
|
259
|
+
projectDir: mockProjectDir,
|
|
260
|
+
});
|
|
261
|
+
expect(helpers_1.createDeveloperTestAccountForLocalDev).toHaveBeenCalledWith(mockTargetProjectAccountId, mockAccountConfig, environments_1.ENVIRONMENTS.PROD);
|
|
262
|
+
expect(LocalDevProcess_1.default).toHaveBeenCalledWith(expect.objectContaining({
|
|
263
|
+
targetTestingAccountId: 999,
|
|
264
|
+
}));
|
|
265
|
+
});
|
|
266
|
+
it('should handle existing developer test account not in config', async () => {
|
|
267
|
+
const notInConfigAccount = { accountId: 777, name: 'external-account' };
|
|
268
|
+
helpers_1.selectAccountTypePrompt.mockResolvedValue(config_1.HUBSPOT_ACCOUNT_TYPES.DEVELOPER_TEST);
|
|
269
|
+
projectDevTargetAccountPrompt_1.selectDeveloperTestTargetAccountPrompt.mockResolvedValue({
|
|
270
|
+
notInConfigAccount,
|
|
271
|
+
});
|
|
272
|
+
await (0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
273
|
+
args: mockArgs,
|
|
274
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
275
|
+
projectConfig: mockProjectConfig,
|
|
276
|
+
projectDir: mockProjectDir,
|
|
277
|
+
});
|
|
278
|
+
expect(helpers_1.useExistingDevTestAccount).toHaveBeenCalledWith(environments_1.ENVIRONMENTS.PROD, notInConfigAccount);
|
|
279
|
+
});
|
|
280
|
+
it('should handle sandbox account selection', async () => {
|
|
281
|
+
helpers_1.selectAccountTypePrompt.mockResolvedValue(config_1.HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX);
|
|
282
|
+
projectDevTargetAccountPrompt_1.selectSandboxTargetAccountPrompt.mockResolvedValue({
|
|
283
|
+
targetAccountId: 888,
|
|
284
|
+
});
|
|
285
|
+
await (0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
286
|
+
args: mockArgs,
|
|
287
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
288
|
+
projectConfig: mockProjectConfig,
|
|
289
|
+
projectDir: mockProjectDir,
|
|
290
|
+
});
|
|
291
|
+
expect(projectDevTargetAccountPrompt_1.selectSandboxTargetAccountPrompt).toHaveBeenCalled();
|
|
292
|
+
expect(LocalDevProcess_1.default).toHaveBeenCalledWith(expect.objectContaining({
|
|
293
|
+
targetTestingAccountId: 888,
|
|
294
|
+
}));
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
describe('project creation', () => {
|
|
298
|
+
it('should create new project when project does not exist', async () => {
|
|
299
|
+
ensureProjectExists_1.ensureProjectExists.mockResolvedValue({
|
|
300
|
+
projectExists: false,
|
|
301
|
+
project: null,
|
|
302
|
+
});
|
|
303
|
+
helpers_1.createNewProjectForLocalDev.mockResolvedValue(mockProject);
|
|
304
|
+
helpers_1.createInitialBuildForNewProject.mockResolvedValue({
|
|
305
|
+
buildId: 456,
|
|
306
|
+
});
|
|
307
|
+
await (0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
308
|
+
args: mockArgs,
|
|
309
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
310
|
+
providedTargetTestingAccountId: mockProvidedTargetTestingAccountId,
|
|
311
|
+
projectConfig: mockProjectConfig,
|
|
312
|
+
projectDir: mockProjectDir,
|
|
313
|
+
});
|
|
314
|
+
expect(helpers_1.createNewProjectForLocalDev).toHaveBeenCalledWith(mockProjectConfig, mockTargetProjectAccountId, false, false);
|
|
315
|
+
expect(helpers_1.createInitialBuildForNewProject).toHaveBeenCalledWith(mockProjectConfig, mockProjectDir, mockTargetProjectAccountId, true, mockArgs.profile);
|
|
316
|
+
});
|
|
317
|
+
it('should use existing project and build when project exists', async () => {
|
|
318
|
+
await (0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
319
|
+
args: mockArgs,
|
|
320
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
321
|
+
providedTargetTestingAccountId: mockProvidedTargetTestingAccountId,
|
|
322
|
+
projectConfig: mockProjectConfig,
|
|
323
|
+
projectDir: mockProjectDir,
|
|
324
|
+
});
|
|
325
|
+
expect(helpers_1.createNewProjectForLocalDev).not.toHaveBeenCalled();
|
|
326
|
+
expect(LocalDevProcess_1.default).toHaveBeenCalledWith(expect.objectContaining({
|
|
327
|
+
deployedBuild: mockProject.deployedBuild,
|
|
328
|
+
projectId: mockProject.id,
|
|
329
|
+
projectName: mockProject.name,
|
|
330
|
+
}));
|
|
331
|
+
});
|
|
332
|
+
it('should detect GitHub linked projects', async () => {
|
|
333
|
+
const githubLinkedProject = {
|
|
334
|
+
...mockProject,
|
|
335
|
+
sourceIntegration: { source: 'GITHUB' },
|
|
336
|
+
};
|
|
337
|
+
ensureProjectExists_1.ensureProjectExists.mockResolvedValue({
|
|
338
|
+
projectExists: true,
|
|
339
|
+
project: githubLinkedProject,
|
|
340
|
+
});
|
|
341
|
+
await (0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
342
|
+
args: mockArgs,
|
|
343
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
344
|
+
providedTargetTestingAccountId: mockProvidedTargetTestingAccountId,
|
|
345
|
+
projectConfig: mockProjectConfig,
|
|
346
|
+
projectDir: mockProjectDir,
|
|
347
|
+
});
|
|
348
|
+
expect(LocalDevProcess_1.default).toHaveBeenCalledWith(expect.objectContaining({
|
|
349
|
+
isGithubLinked: true,
|
|
350
|
+
}));
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
describe('local dev process setup', () => {
|
|
354
|
+
it('should initialize LocalDevProcess with correct parameters', async () => {
|
|
355
|
+
await (0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
356
|
+
args: mockArgs,
|
|
357
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
358
|
+
providedTargetTestingAccountId: mockProvidedTargetTestingAccountId,
|
|
359
|
+
projectConfig: mockProjectConfig,
|
|
360
|
+
projectDir: mockProjectDir,
|
|
361
|
+
});
|
|
362
|
+
expect(LocalDevProcess_1.default).toHaveBeenCalledWith({
|
|
363
|
+
initialProjectNodes: mockProjectNodes,
|
|
364
|
+
debug: mockArgs.debug,
|
|
365
|
+
deployedBuild: mockProject.deployedBuild,
|
|
366
|
+
isGithubLinked: false,
|
|
367
|
+
profile: mockArgs.profile,
|
|
368
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
369
|
+
targetTestingAccountId: mockProvidedTargetTestingAccountId,
|
|
370
|
+
projectConfig: mockProjectConfig,
|
|
371
|
+
projectDir: mockProjectDir,
|
|
372
|
+
projectName: mockProject.name,
|
|
373
|
+
projectId: mockProject.id,
|
|
374
|
+
env: environments_1.ENVIRONMENTS.PROD,
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
it('should set up keypress and exit handlers', async () => {
|
|
378
|
+
await (0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
379
|
+
args: mockArgs,
|
|
380
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
381
|
+
providedTargetTestingAccountId: mockProvidedTargetTestingAccountId,
|
|
382
|
+
projectConfig: mockProjectConfig,
|
|
383
|
+
projectDir: mockProjectDir,
|
|
384
|
+
});
|
|
385
|
+
expect(process_1.handleKeypress).toHaveBeenCalledWith(expect.any(Function));
|
|
386
|
+
expect(process_1.handleExit).toHaveBeenCalledWith(expect.any(Function));
|
|
387
|
+
});
|
|
388
|
+
it('should start all required services', async () => {
|
|
389
|
+
await (0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
390
|
+
args: mockArgs,
|
|
391
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
392
|
+
providedTargetTestingAccountId: mockProvidedTargetTestingAccountId,
|
|
393
|
+
projectConfig: mockProjectConfig,
|
|
394
|
+
projectDir: mockProjectDir,
|
|
395
|
+
});
|
|
396
|
+
expect(mockLocalDevProcess.start).toHaveBeenCalled();
|
|
397
|
+
expect(mockLocalDevWatcher.start).toHaveBeenCalled();
|
|
398
|
+
expect(mockWebsocketServer.start).toHaveBeenCalled();
|
|
399
|
+
expect(SpinniesManager_1.default.init).toHaveBeenCalled();
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
describe('UI messaging', () => {
|
|
403
|
+
beforeEach(() => {
|
|
404
|
+
accountTypes_1.isTestAccountOrSandbox.mockReturnValue(false);
|
|
405
|
+
});
|
|
406
|
+
it('should display account type information when prompting', async () => {
|
|
407
|
+
helpers_1.selectAccountTypePrompt.mockResolvedValue(config_1.HUBSPOT_ACCOUNT_TYPES.STANDARD);
|
|
408
|
+
await (0, unifiedFlow_1.unifiedProjectDevFlow)({
|
|
409
|
+
args: mockArgs,
|
|
410
|
+
targetProjectAccountId: mockTargetProjectAccountId,
|
|
411
|
+
projectConfig: mockProjectConfig,
|
|
412
|
+
projectDir: mockProjectDir,
|
|
413
|
+
});
|
|
414
|
+
expect(ui_1.uiLine).toHaveBeenCalled();
|
|
415
|
+
expect(logger_1.uiLogger.log).toHaveBeenCalledWith(en_1.commands.project.dev.logs.accountTypeInformation);
|
|
416
|
+
expect(logger_1.uiLogger.log).toHaveBeenCalledWith(en_1.commands.project.dev.logs.learnMoreMessage);
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
7
|
+
const commonOpts_1 = require("../../../lib/commonOpts");
|
|
8
|
+
const download_1 = __importDefault(require("../download"));
|
|
9
|
+
vi.mock('../../../lib/commonOpts');
|
|
10
|
+
describe('commands/project/download', () => {
|
|
11
|
+
const yargsMock = yargs_1.default;
|
|
12
|
+
describe('command', () => {
|
|
13
|
+
it('should have the correct command structure', () => {
|
|
14
|
+
expect(download_1.default.command).toEqual('download');
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
describe('describe', () => {
|
|
18
|
+
it('should provide a description', () => {
|
|
19
|
+
expect(download_1.default.describe).toBeDefined();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
describe('builder', () => {
|
|
23
|
+
it('should support the correct options', () => {
|
|
24
|
+
download_1.default.builder(yargsMock);
|
|
25
|
+
expect(commonOpts_1.addAccountOptions).toHaveBeenCalledTimes(1);
|
|
26
|
+
expect(commonOpts_1.addAccountOptions).toHaveBeenCalledWith(yargsMock);
|
|
27
|
+
expect(commonOpts_1.addConfigOptions).toHaveBeenCalledTimes(1);
|
|
28
|
+
expect(commonOpts_1.addConfigOptions).toHaveBeenCalledWith(yargsMock);
|
|
29
|
+
expect(commonOpts_1.addUseEnvironmentOptions).toHaveBeenCalledTimes(1);
|
|
30
|
+
expect(commonOpts_1.addUseEnvironmentOptions).toHaveBeenCalledWith(yargsMock);
|
|
31
|
+
});
|
|
32
|
+
it('should define project, dest, and build options', () => {
|
|
33
|
+
const optionsSpy = vi.spyOn(yargsMock, 'options');
|
|
34
|
+
const exampleSpy = vi.spyOn(yargsMock, 'example');
|
|
35
|
+
download_1.default.builder(yargsMock);
|
|
36
|
+
expect(optionsSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
37
|
+
project: expect.any(Object),
|
|
38
|
+
dest: expect.any(Object),
|
|
39
|
+
build: expect.any(Object),
|
|
40
|
+
}));
|
|
41
|
+
expect(exampleSpy).toHaveBeenCalled();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"latestBuild": {
|
|
3
|
+
"activitySource": {
|
|
4
|
+
"userId": 123,
|
|
5
|
+
"type": "HUBSPOT"
|
|
6
|
+
},
|
|
7
|
+
"buildId": 8,
|
|
8
|
+
"createdAt": "123456",
|
|
9
|
+
"deployableState": "DEPLOYABLE",
|
|
10
|
+
"deployStatusTaskLocator": {
|
|
11
|
+
"id": "123",
|
|
12
|
+
"links": []
|
|
13
|
+
},
|
|
14
|
+
"enqueuedAt": "123456",
|
|
15
|
+
"finishedAt": "123456",
|
|
16
|
+
"isAutoDeployEnabled": true,
|
|
17
|
+
"portalId": 123,
|
|
18
|
+
"projectName": "project name",
|
|
19
|
+
"startedAt": "123456",
|
|
20
|
+
"status": "SUCCESS",
|
|
21
|
+
"subbuildStatuses": [],
|
|
22
|
+
"uploadMessage": "Upload message",
|
|
23
|
+
"autoDeployId": 123
|
|
24
|
+
},
|
|
25
|
+
"deployedBuildId": 1,
|
|
26
|
+
"createdAt": 123456,
|
|
27
|
+
"deletedAt": 123456,
|
|
28
|
+
"updatedAt": 123456,
|
|
29
|
+
"id": 123,
|
|
30
|
+
"isLocked": false,
|
|
31
|
+
"name": "project name",
|
|
32
|
+
"portalId": 123
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|