@hubspot/cli 7.7.19-experimental.2 → 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,60 @@
|
|
|
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 create_1 = __importDefault(require("../testAccount/create"));
|
|
8
|
+
const createConfig_1 = __importDefault(require("../testAccount/createConfig"));
|
|
9
|
+
const delete_1 = __importDefault(require("../testAccount/delete"));
|
|
10
|
+
const testAccount_1 = __importDefault(require("../testAccount"));
|
|
11
|
+
vi.mock('../testAccount/create');
|
|
12
|
+
vi.mock('../testAccount/createConfig');
|
|
13
|
+
vi.mock('../testAccount/delete');
|
|
14
|
+
vi.mock('../../lib/commonOpts');
|
|
15
|
+
const commandSpy = vi
|
|
16
|
+
.spyOn(yargs_1.default, 'command')
|
|
17
|
+
.mockReturnValue(yargs_1.default);
|
|
18
|
+
const demandCommandSpy = vi
|
|
19
|
+
.spyOn(yargs_1.default, 'demandCommand')
|
|
20
|
+
.mockReturnValue(yargs_1.default);
|
|
21
|
+
describe('commands/testAccount', () => {
|
|
22
|
+
describe('command', () => {
|
|
23
|
+
it('should have the correct command structure', () => {
|
|
24
|
+
expect(testAccount_1.default.command).toEqual([
|
|
25
|
+
'test-account',
|
|
26
|
+
'test-accounts',
|
|
27
|
+
]);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
// This is commented out because the description is undefined rn
|
|
31
|
+
// describe('describe', () => {
|
|
32
|
+
// it('should provide a description', () => {
|
|
33
|
+
// expect(testAccountCommands.describe).toBeDefined();
|
|
34
|
+
// });
|
|
35
|
+
// });
|
|
36
|
+
describe('builder', () => {
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
commandSpy.mockClear();
|
|
39
|
+
demandCommandSpy.mockClear();
|
|
40
|
+
});
|
|
41
|
+
const subcommands = [
|
|
42
|
+
create_1.default,
|
|
43
|
+
createConfig_1.default,
|
|
44
|
+
delete_1.default,
|
|
45
|
+
];
|
|
46
|
+
it('should demand the command takes one positional argument', () => {
|
|
47
|
+
testAccount_1.default.builder(yargs_1.default);
|
|
48
|
+
expect(demandCommandSpy).toHaveBeenCalledTimes(1);
|
|
49
|
+
expect(demandCommandSpy).toHaveBeenCalledWith(1, '');
|
|
50
|
+
});
|
|
51
|
+
it('should add the correct number of sub commands', () => {
|
|
52
|
+
testAccount_1.default.builder(yargs_1.default);
|
|
53
|
+
expect(commandSpy).toHaveBeenCalledTimes(subcommands.length);
|
|
54
|
+
});
|
|
55
|
+
it.each(subcommands)('should attach the %s subcommand', module => {
|
|
56
|
+
testAccount_1.default.builder(yargs_1.default);
|
|
57
|
+
expect(commandSpy).toHaveBeenCalledWith(module);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
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 preview_1 = __importDefault(require("../theme/preview"));
|
|
8
|
+
const generate_selectors_1 = __importDefault(require("../theme/generate-selectors"));
|
|
9
|
+
const marketplace_validate_1 = __importDefault(require("../theme/marketplace-validate"));
|
|
10
|
+
const theme_1 = __importDefault(require("../theme"));
|
|
11
|
+
vi.mock('../theme/preview');
|
|
12
|
+
vi.mock('../theme/generate-selectors');
|
|
13
|
+
vi.mock('../theme/marketplace-validate');
|
|
14
|
+
vi.mock('../../lib/commonOpts');
|
|
15
|
+
const commandSpy = vi
|
|
16
|
+
.spyOn(yargs_1.default, 'command')
|
|
17
|
+
.mockReturnValue(yargs_1.default);
|
|
18
|
+
const demandCommandSpy = vi
|
|
19
|
+
.spyOn(yargs_1.default, 'demandCommand')
|
|
20
|
+
.mockReturnValue(yargs_1.default);
|
|
21
|
+
describe('commands/theme', () => {
|
|
22
|
+
describe('command', () => {
|
|
23
|
+
it('should have the correct command structure', () => {
|
|
24
|
+
expect(theme_1.default.command).toEqual(['theme', 'themes']);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
describe('describe', () => {
|
|
28
|
+
it('should provide a description', () => {
|
|
29
|
+
expect(theme_1.default.describe).toBeDefined();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
describe('builder', () => {
|
|
33
|
+
beforeEach(() => {
|
|
34
|
+
commandSpy.mockClear();
|
|
35
|
+
demandCommandSpy.mockClear();
|
|
36
|
+
});
|
|
37
|
+
const subcommands = [preview_1.default, generate_selectors_1.default, marketplace_validate_1.default];
|
|
38
|
+
it('should demand the command takes one positional argument', () => {
|
|
39
|
+
theme_1.default.builder(yargs_1.default);
|
|
40
|
+
expect(demandCommandSpy).toHaveBeenCalledTimes(1);
|
|
41
|
+
expect(demandCommandSpy).toHaveBeenCalledWith(1, '');
|
|
42
|
+
});
|
|
43
|
+
it('should add the correct number of sub commands', () => {
|
|
44
|
+
theme_1.default.builder(yargs_1.default);
|
|
45
|
+
expect(commandSpy).toHaveBeenCalledTimes(subcommands.length);
|
|
46
|
+
});
|
|
47
|
+
it.each(subcommands)('should attach the %s subcommand', module => {
|
|
48
|
+
theme_1.default.builder(yargs_1.default);
|
|
49
|
+
expect(commandSpy).toHaveBeenCalledWith(module);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
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 auth_1 = __importDefault(require("../auth"));
|
|
9
|
+
vi.mock('../../../lib/commonOpts');
|
|
10
|
+
describe('commands/account/auth', () => {
|
|
11
|
+
const yargsMock = yargs_1.default;
|
|
12
|
+
describe('command', () => {
|
|
13
|
+
it('should have the correct command structure', () => {
|
|
14
|
+
expect(auth_1.default.command).toEqual('auth');
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
describe('describe', () => {
|
|
18
|
+
it('should provide a description', () => {
|
|
19
|
+
expect(auth_1.default.describe).toBeDefined();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
describe('builder', () => {
|
|
23
|
+
it('should support the correct options', () => {
|
|
24
|
+
auth_1.default.builder(yargsMock);
|
|
25
|
+
expect(commonOpts_1.addTestingOptions).toHaveBeenCalledTimes(1);
|
|
26
|
+
expect(commonOpts_1.addTestingOptions).toHaveBeenCalledWith(yargsMock);
|
|
27
|
+
expect(commonOpts_1.addGlobalOptions).toHaveBeenCalledTimes(1);
|
|
28
|
+
expect(commonOpts_1.addGlobalOptions).toHaveBeenCalledWith(yargsMock);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
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 commonOpts_2 = require("../../../lib/commonOpts");
|
|
9
|
+
const clean_1 = __importDefault(require("../clean"));
|
|
10
|
+
vi.mock('../../../lib/commonOpts');
|
|
11
|
+
describe('commands/account/clean', () => {
|
|
12
|
+
const yargsMock = yargs_1.default;
|
|
13
|
+
describe('command', () => {
|
|
14
|
+
it('should have the correct command structure', () => {
|
|
15
|
+
expect(clean_1.default.command).toEqual('clean');
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
describe('describe', () => {
|
|
19
|
+
it('should provide a description', () => {
|
|
20
|
+
expect(clean_1.default.describe).toBeDefined();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
describe('builder', () => {
|
|
24
|
+
it('should support the correct options', () => {
|
|
25
|
+
clean_1.default.builder(yargsMock);
|
|
26
|
+
expect(yargsMock.example).toHaveBeenCalledTimes(1);
|
|
27
|
+
expect(commonOpts_1.addConfigOptions).toHaveBeenCalledTimes(1);
|
|
28
|
+
expect(commonOpts_1.addConfigOptions).toHaveBeenCalledWith(yargsMock);
|
|
29
|
+
expect(commonOpts_2.addTestingOptions).toHaveBeenCalledTimes(1);
|
|
30
|
+
expect(commonOpts_2.addTestingOptions).toHaveBeenCalledWith(yargsMock);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
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 createOverride_1 = __importDefault(require("../createOverride"));
|
|
8
|
+
const positionalSpy = vi
|
|
9
|
+
.spyOn(yargs_1.default, 'positional')
|
|
10
|
+
.mockReturnValue(yargs_1.default);
|
|
11
|
+
const exampleSpy = vi
|
|
12
|
+
.spyOn(yargs_1.default, 'example')
|
|
13
|
+
.mockReturnValue(yargs_1.default);
|
|
14
|
+
describe('commands/account/createOverride', () => {
|
|
15
|
+
const yargsMock = yargs_1.default;
|
|
16
|
+
describe('command', () => {
|
|
17
|
+
it('should have the correct command structure', () => {
|
|
18
|
+
expect(createOverride_1.default.command).toEqual('create-override [account]');
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe('describe', () => {
|
|
22
|
+
it('should provide a description', () => {
|
|
23
|
+
expect(createOverride_1.default.describe).toBeDefined();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
describe('builder', () => {
|
|
27
|
+
it('should support the correct options', () => {
|
|
28
|
+
createOverride_1.default.builder(yargsMock);
|
|
29
|
+
expect(exampleSpy).toHaveBeenCalledTimes(1);
|
|
30
|
+
expect(positionalSpy).toHaveBeenCalledTimes(1);
|
|
31
|
+
expect(positionalSpy).toHaveBeenCalledWith('account', {
|
|
32
|
+
describe: expect.any(String),
|
|
33
|
+
type: 'string',
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
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 info_1 = __importDefault(require("../info"));
|
|
9
|
+
vi.mock('../../../lib/commonOpts');
|
|
10
|
+
const exampleSpy = vi
|
|
11
|
+
.spyOn(yargs_1.default, 'example')
|
|
12
|
+
.mockReturnValue(yargs_1.default);
|
|
13
|
+
describe('commands/account/info', () => {
|
|
14
|
+
const yargsMock = yargs_1.default;
|
|
15
|
+
describe('command', () => {
|
|
16
|
+
it('should have the correct command structure', () => {
|
|
17
|
+
expect(info_1.default.command).toEqual('info [account]');
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
describe('describe', () => {
|
|
21
|
+
it('should provide a description', () => {
|
|
22
|
+
expect(info_1.default.describe).toBeDefined();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
describe('builder', () => {
|
|
26
|
+
it('should support the correct options', () => {
|
|
27
|
+
info_1.default.builder(yargsMock);
|
|
28
|
+
expect(exampleSpy).toHaveBeenCalledTimes(1);
|
|
29
|
+
expect(commonOpts_1.addConfigOptions).toHaveBeenCalledTimes(1);
|
|
30
|
+
expect(commonOpts_1.addConfigOptions).toHaveBeenCalledWith(yargsMock);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
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 list_1 = __importDefault(require("../list"));
|
|
9
|
+
vi.mock('../../../lib/commonOpts');
|
|
10
|
+
const exampleSpy = vi
|
|
11
|
+
.spyOn(yargs_1.default, 'example')
|
|
12
|
+
.mockReturnValue(yargs_1.default);
|
|
13
|
+
describe('commands/account/list', () => {
|
|
14
|
+
const yargsMock = yargs_1.default;
|
|
15
|
+
describe('command', () => {
|
|
16
|
+
it('should have the correct command structure', () => {
|
|
17
|
+
expect(list_1.default.command).toEqual(['list', 'ls']);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
describe('describe', () => {
|
|
21
|
+
it('should provide a description', () => {
|
|
22
|
+
expect(list_1.default.describe).toBeDefined();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
describe('builder', () => {
|
|
26
|
+
it('should support the correct options', () => {
|
|
27
|
+
list_1.default.builder(yargsMock);
|
|
28
|
+
expect(exampleSpy).toHaveBeenCalledTimes(1);
|
|
29
|
+
expect(commonOpts_1.addConfigOptions).toHaveBeenCalledTimes(1);
|
|
30
|
+
expect(commonOpts_1.addConfigOptions).toHaveBeenCalledWith(yargsMock);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
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 remove_1 = __importDefault(require("../remove"));
|
|
9
|
+
vi.mock('../../../lib/commonOpts');
|
|
10
|
+
const positionalSpy = vi
|
|
11
|
+
.spyOn(yargs_1.default, 'positional')
|
|
12
|
+
.mockReturnValue(yargs_1.default);
|
|
13
|
+
const exampleSpy = vi
|
|
14
|
+
.spyOn(yargs_1.default, 'example')
|
|
15
|
+
.mockReturnValue(yargs_1.default);
|
|
16
|
+
describe('commands/account/remove', () => {
|
|
17
|
+
const yargsMock = yargs_1.default;
|
|
18
|
+
describe('command', () => {
|
|
19
|
+
it('should have the correct command structure', () => {
|
|
20
|
+
expect(remove_1.default.command).toEqual('remove [account]');
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
describe('describe', () => {
|
|
24
|
+
it('should provide a description', () => {
|
|
25
|
+
expect(remove_1.default.describe).toBeDefined();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
describe('builder', () => {
|
|
29
|
+
it('should support the correct options', () => {
|
|
30
|
+
remove_1.default.builder(yargsMock);
|
|
31
|
+
expect(exampleSpy).toHaveBeenCalledTimes(1);
|
|
32
|
+
expect(positionalSpy).toHaveBeenCalledTimes(1);
|
|
33
|
+
expect(positionalSpy).toHaveBeenCalledWith('account', {
|
|
34
|
+
describe: expect.any(String),
|
|
35
|
+
type: 'string',
|
|
36
|
+
});
|
|
37
|
+
expect(commonOpts_1.addConfigOptions).toHaveBeenCalledTimes(1);
|
|
38
|
+
expect(commonOpts_1.addConfigOptions).toHaveBeenCalledWith(yargsMock);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
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 removeOverride_1 = __importDefault(require("../removeOverride"));
|
|
8
|
+
vi.mock('yargs');
|
|
9
|
+
const optionsSpy = vi
|
|
10
|
+
.spyOn(yargs_1.default, 'options')
|
|
11
|
+
.mockReturnValue(yargs_1.default);
|
|
12
|
+
describe('commands/account/removeOverride', () => {
|
|
13
|
+
const yargsMock = yargs_1.default;
|
|
14
|
+
describe('command', () => {
|
|
15
|
+
it('should have the correct command structure', () => {
|
|
16
|
+
expect(removeOverride_1.default.command).toEqual('remove-override');
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
describe('describe', () => {
|
|
20
|
+
it('should provide a description', () => {
|
|
21
|
+
expect(removeOverride_1.default.describe).toBeDefined();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
describe('builder', () => {
|
|
25
|
+
it('should support the correct options', () => {
|
|
26
|
+
removeOverride_1.default.builder(yargsMock);
|
|
27
|
+
expect(optionsSpy).toHaveBeenCalledTimes(1);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
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 rename_1 = __importDefault(require("../rename"));
|
|
9
|
+
vi.mock('../../../lib/commonOpts');
|
|
10
|
+
const positionalSpy = vi
|
|
11
|
+
.spyOn(yargs_1.default, 'positional')
|
|
12
|
+
.mockReturnValue(yargs_1.default);
|
|
13
|
+
const exampleSpy = vi
|
|
14
|
+
.spyOn(yargs_1.default, 'example')
|
|
15
|
+
.mockReturnValue(yargs_1.default);
|
|
16
|
+
describe('commands/account/rename', () => {
|
|
17
|
+
const yargsMock = yargs_1.default;
|
|
18
|
+
describe('command', () => {
|
|
19
|
+
it('should have the correct command structure', () => {
|
|
20
|
+
expect(rename_1.default.command).toEqual('rename <account-name> <new-name>');
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
describe('describe', () => {
|
|
24
|
+
it('should provide a description', () => {
|
|
25
|
+
expect(rename_1.default.describe).toBeDefined();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
describe('builder', () => {
|
|
29
|
+
it('should support the correct options', () => {
|
|
30
|
+
rename_1.default.builder(yargsMock);
|
|
31
|
+
expect(exampleSpy).toHaveBeenCalledTimes(1);
|
|
32
|
+
expect(positionalSpy).toHaveBeenCalledTimes(2);
|
|
33
|
+
expect(positionalSpy).toHaveBeenCalledWith('account-name', {
|
|
34
|
+
describe: expect.any(String),
|
|
35
|
+
type: 'string',
|
|
36
|
+
});
|
|
37
|
+
expect(positionalSpy).toHaveBeenCalledWith('new-name', {
|
|
38
|
+
describe: expect.any(String),
|
|
39
|
+
type: 'string',
|
|
40
|
+
});
|
|
41
|
+
expect(commonOpts_1.addConfigOptions).toHaveBeenCalledTimes(1);
|
|
42
|
+
expect(commonOpts_1.addConfigOptions).toHaveBeenCalledWith(yargsMock);
|
|
43
|
+
expect(commonOpts_1.addAccountOptions).toHaveBeenCalledTimes(1);
|
|
44
|
+
expect(commonOpts_1.addAccountOptions).toHaveBeenCalledWith(yargsMock);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
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 use_1 = __importDefault(require("../use"));
|
|
8
|
+
const positionalSpy = vi
|
|
9
|
+
.spyOn(yargs_1.default, 'positional')
|
|
10
|
+
.mockReturnValue(yargs_1.default);
|
|
11
|
+
const exampleSpy = vi
|
|
12
|
+
.spyOn(yargs_1.default, 'example')
|
|
13
|
+
.mockReturnValue(yargs_1.default);
|
|
14
|
+
describe('commands/account/use', () => {
|
|
15
|
+
const yargsMock = yargs_1.default;
|
|
16
|
+
describe('command', () => {
|
|
17
|
+
it('should have the correct command structure', () => {
|
|
18
|
+
expect(use_1.default.command).toEqual('use [account]');
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe('describe', () => {
|
|
22
|
+
it('should provide a description', () => {
|
|
23
|
+
expect(use_1.default.describe).toBeDefined();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
describe('builder', () => {
|
|
27
|
+
it('should support the correct options', () => {
|
|
28
|
+
use_1.default.builder(yargsMock);
|
|
29
|
+
expect(exampleSpy).toHaveBeenCalledTimes(1);
|
|
30
|
+
expect(positionalSpy).toHaveBeenCalledTimes(1);
|
|
31
|
+
expect(positionalSpy).toHaveBeenCalledWith('account', {
|
|
32
|
+
describe: expect.any(String),
|
|
33
|
+
type: 'string',
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,129 @@
|
|
|
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 projects_1 = require("@hubspot/local-dev-lib/constants/projects");
|
|
8
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
9
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
10
|
+
const migrate_1 = require("../../../lib/app/migrate");
|
|
11
|
+
const migrate_legacy_1 = require("../../../lib/app/migrate_legacy");
|
|
12
|
+
const exitCodes_1 = require("../../../lib/enums/exitCodes");
|
|
13
|
+
const migrate_2 = __importDefault(require("../migrate"));
|
|
14
|
+
vi.mock('@hubspot/local-dev-lib/config');
|
|
15
|
+
vi.mock('@hubspot/local-dev-lib/logger');
|
|
16
|
+
vi.mock('../../../lib/app/migrate');
|
|
17
|
+
vi.mock('../../../lib/app/migrate_legacy');
|
|
18
|
+
const mockYargs = yargs_1.default;
|
|
19
|
+
const mockedGetAccountConfig = config_1.getAccountConfig;
|
|
20
|
+
const mockedMigrateApp2023_2 = migrate_legacy_1.migrateApp2023_2;
|
|
21
|
+
const mockedMigrateApp2025_2 = migrate_1.migrateApp2025_2;
|
|
22
|
+
const mockedLogger = logger_1.logger;
|
|
23
|
+
const optionsSpy = vi.spyOn(mockYargs, 'options');
|
|
24
|
+
const exampleSpy = vi.spyOn(mockYargs, 'example');
|
|
25
|
+
const exitSpy = vi
|
|
26
|
+
.spyOn(process, 'exit')
|
|
27
|
+
.mockImplementation(() => undefined);
|
|
28
|
+
describe('commands/app/migrate', () => {
|
|
29
|
+
const mockAccountId = 123;
|
|
30
|
+
const mockAccountConfig = {
|
|
31
|
+
name: 'Test Account',
|
|
32
|
+
env: 'prod',
|
|
33
|
+
};
|
|
34
|
+
beforeEach(() => {
|
|
35
|
+
mockedGetAccountConfig.mockReturnValue(mockAccountConfig);
|
|
36
|
+
exitSpy.mockClear();
|
|
37
|
+
});
|
|
38
|
+
afterEach(() => {
|
|
39
|
+
exitSpy.mockClear();
|
|
40
|
+
});
|
|
41
|
+
describe('handler', () => {
|
|
42
|
+
it('should exit with error when no account config is found', async () => {
|
|
43
|
+
mockedGetAccountConfig.mockReturnValue(null);
|
|
44
|
+
await migrate_2.default.handler({
|
|
45
|
+
derivedAccountId: mockAccountId,
|
|
46
|
+
});
|
|
47
|
+
expect(mockedLogger.error).toHaveBeenCalled();
|
|
48
|
+
expect(exitSpy).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
49
|
+
});
|
|
50
|
+
it('should call migrateApp2025_2 for platform version 2025.2', async () => {
|
|
51
|
+
const options = {
|
|
52
|
+
derivedAccountId: mockAccountId,
|
|
53
|
+
platformVersion: projects_1.PLATFORM_VERSIONS.v2025_2,
|
|
54
|
+
};
|
|
55
|
+
await migrate_2.default.handler(options);
|
|
56
|
+
expect(mockedMigrateApp2025_2).toHaveBeenCalledWith(mockAccountId, options);
|
|
57
|
+
expect(mockedMigrateApp2023_2).not.toHaveBeenCalled();
|
|
58
|
+
expect(exitSpy).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
59
|
+
});
|
|
60
|
+
it('should call migrateApp2025_2 when unstable is true', async () => {
|
|
61
|
+
const options = {
|
|
62
|
+
derivedAccountId: mockAccountId,
|
|
63
|
+
unstable: true,
|
|
64
|
+
};
|
|
65
|
+
await migrate_2.default.handler(options);
|
|
66
|
+
expect(mockedMigrateApp2025_2).toHaveBeenCalledWith(mockAccountId, options);
|
|
67
|
+
expect(mockedMigrateApp2023_2).not.toHaveBeenCalled();
|
|
68
|
+
expect(exitSpy).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
69
|
+
});
|
|
70
|
+
it('should call migrateApp2023_2 for platform version 2023.2', async () => {
|
|
71
|
+
const options = {
|
|
72
|
+
derivedAccountId: mockAccountId,
|
|
73
|
+
platformVersion: projects_1.PLATFORM_VERSIONS.v2023_2,
|
|
74
|
+
};
|
|
75
|
+
await migrate_2.default.handler(options);
|
|
76
|
+
expect(mockedMigrateApp2023_2).toHaveBeenCalledWith(mockAccountId, options, mockAccountConfig);
|
|
77
|
+
expect(mockedMigrateApp2025_2).not.toHaveBeenCalled();
|
|
78
|
+
expect(exitSpy).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
79
|
+
});
|
|
80
|
+
it('should handle errors during migration', async () => {
|
|
81
|
+
const mockError = new Error('Migration failed');
|
|
82
|
+
mockedMigrateApp2023_2.mockRejectedValue(mockError);
|
|
83
|
+
await migrate_2.default.handler({
|
|
84
|
+
derivedAccountId: mockAccountId,
|
|
85
|
+
platformVersion: projects_1.PLATFORM_VERSIONS.v2023_2,
|
|
86
|
+
});
|
|
87
|
+
expect(mockedLogger.error).toHaveBeenCalled();
|
|
88
|
+
expect(exitSpy).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
describe('builder', () => {
|
|
92
|
+
it('should add required options', async () => {
|
|
93
|
+
await migrate_2.default.builder(mockYargs);
|
|
94
|
+
expect(optionsSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
95
|
+
name: expect.objectContaining({
|
|
96
|
+
type: 'string',
|
|
97
|
+
describe: expect.any(String),
|
|
98
|
+
}),
|
|
99
|
+
dest: expect.objectContaining({
|
|
100
|
+
type: 'string',
|
|
101
|
+
describe: expect.any(String),
|
|
102
|
+
}),
|
|
103
|
+
'app-id': expect.objectContaining({
|
|
104
|
+
type: 'number',
|
|
105
|
+
describe: expect.any(String),
|
|
106
|
+
}),
|
|
107
|
+
'platform-version': expect.objectContaining({
|
|
108
|
+
type: 'string',
|
|
109
|
+
default: '2025.2',
|
|
110
|
+
hidden: true,
|
|
111
|
+
}),
|
|
112
|
+
}));
|
|
113
|
+
});
|
|
114
|
+
it('should set default platform version to 2025.2', async () => {
|
|
115
|
+
await migrate_2.default.builder(mockYargs);
|
|
116
|
+
expect(optionsSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
117
|
+
'platform-version': expect.objectContaining({
|
|
118
|
+
default: '2025.2',
|
|
119
|
+
}),
|
|
120
|
+
}));
|
|
121
|
+
});
|
|
122
|
+
it('should add example command', async () => {
|
|
123
|
+
await migrate_2.default.builder(mockYargs);
|
|
124
|
+
expect(exampleSpy).toHaveBeenCalledWith([
|
|
125
|
+
['$0 app migrate', expect.any(String)],
|
|
126
|
+
]);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
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 add_1 = __importDefault(require("../add"));
|
|
8
|
+
vi.mock('../../../../lib/commonOpts');
|
|
9
|
+
describe('commands/app/secret/add', () => {
|
|
10
|
+
const yargsMock = yargs_1.default;
|
|
11
|
+
describe('command', () => {
|
|
12
|
+
it('should have the correct command structure', () => {
|
|
13
|
+
expect(add_1.default.command).toEqual('add [name]');
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
describe('describe', () => {
|
|
17
|
+
it('should provide a description', () => {
|
|
18
|
+
expect(add_1.default.describe).toBeDefined();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe('builder', () => {
|
|
22
|
+
it('should support the correct options', () => {
|
|
23
|
+
add_1.default.builder(yargsMock);
|
|
24
|
+
expect(yargsMock.example).toHaveBeenCalledTimes(1);
|
|
25
|
+
expect(yargsMock.positional).toHaveBeenCalledWith('name', expect.objectContaining({
|
|
26
|
+
type: 'string',
|
|
27
|
+
}));
|
|
28
|
+
expect(yargsMock.option).toHaveBeenCalledWith('app', expect.objectContaining({
|
|
29
|
+
type: 'number',
|
|
30
|
+
}));
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|