@sasjs/cli 3.6.2 → 3.6.3
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/build/cli.js +4 -4
- package/build/cli.spec.js +6 -6
- package/build/commands/add/addCommand.js +2 -2
- package/build/commands/add/addCredential.js +27 -27
- package/build/commands/add/addTarget.js +10 -10
- package/build/commands/add/internal/input.js +30 -30
- package/build/commands/add/internal/saveConfig.js +2 -2
- package/build/commands/add/spec/addCommand.spec.js +24 -20
- package/build/commands/add/spec/addCredential.spec.js +14 -14
- package/build/commands/add/spec/addTarget.spec.js +22 -22
- package/build/commands/build/build.js +81 -77
- package/build/commands/build/buildCommand.js +3 -3
- package/build/commands/build/compileBuildCommand.js +4 -4
- package/build/commands/build/internal/config.js +8 -8
- package/build/commands/build/internal/getLaunchPageCode.js +2 -2
- package/build/commands/build/spec/build.spec.js +10 -10
- package/build/commands/build/spec/buildCommand.spec.js +16 -12
- package/build/commands/build/spec/cb.spec.server.js +18 -18
- package/build/commands/build/spec/compileBuildCommand.spec.js +17 -13
- package/build/commands/compile/compile.js +61 -61
- package/build/commands/compile/compileCommand.js +10 -10
- package/build/commands/compile/compileSingleFile.js +17 -17
- package/build/commands/compile/internal/checkCompileStatus.js +11 -11
- package/build/commands/compile/internal/compareFolders.js +11 -11
- package/build/commands/compile/internal/compileJobFile.js +3 -3
- package/build/commands/compile/internal/compileServiceFile.js +14 -14
- package/build/commands/compile/internal/compileTestFile.js +41 -37
- package/build/commands/compile/internal/getAllJobFolders.js +13 -9
- package/build/commands/compile/internal/getAllServiceFolders.js +13 -9
- package/build/commands/compile/internal/getServerType.js +1 -1
- package/build/commands/compile/internal/identifySasFile.js +2 -2
- package/build/commands/compile/internal/loadDependencies.js +5 -5
- package/build/commands/compile/internal/spec/compileTestFile.spec.js +40 -40
- package/build/commands/compile/spec/compareFolders.spec.js +27 -27
- package/build/commands/compile/spec/compile.spec.js +93 -93
- package/build/commands/compile/spec/compileCommand.spec.js +37 -33
- package/build/commands/compile/spec/compileJobFile.spec.js +11 -11
- package/build/commands/compile/spec/compileServiceFile.spec.js +11 -11
- package/build/commands/compile/spec/copyFilesToBuildFolder.spec.js +7 -7
- package/build/commands/compile/spec/loadDependencies.spec.js +30 -30
- package/build/commands/context/contextCommand.js +16 -16
- package/build/commands/context/create.js +1 -1
- package/build/commands/context/delete.js +2 -2
- package/build/commands/context/edit.js +1 -1
- package/build/commands/context/export.js +5 -5
- package/build/commands/context/internal/validateConfigPath.js +1 -1
- package/build/commands/context/list.js +4 -4
- package/build/commands/context/spec/contextCommand.spec.js +80 -76
- package/build/commands/context/spec/create.spec.js +3 -3
- package/build/commands/context/spec/delete.spec.js +3 -3
- package/build/commands/context/spec/edit.spec.js +3 -3
- package/build/commands/context/spec/export.spec.js +8 -8
- package/build/commands/context/spec/list.spec.js +5 -5
- package/build/commands/create/create.js +12 -12
- package/build/commands/create/createCommand.js +2 -2
- package/build/commands/create/internal/createReadme.js +2 -2
- package/build/commands/create/spec/create.spec.js +39 -39
- package/build/commands/create/spec/createCommand.spec.js +14 -10
- package/build/commands/db/db.js +22 -22
- package/build/commands/db/dbCommand.js +1 -1
- package/build/commands/db/spec/db.spec.js +8 -8
- package/build/commands/db/spec/dbCommand.spec.js +11 -7
- package/build/commands/deploy/compileBuildDeployCommand.js +6 -6
- package/build/commands/deploy/deploy.js +39 -39
- package/build/commands/deploy/deployCommand.js +2 -2
- package/build/commands/deploy/internal/getDeployScripts.js +14 -10
- package/build/commands/deploy/spec/cbd.spec.js +14 -14
- package/build/commands/deploy/spec/cbd.spec.server.js +40 -40
- package/build/commands/deploy/spec/compileBuildDeployCommand.spec.js +18 -14
- package/build/commands/deploy/spec/deployCommand.spec.js +15 -11
- package/build/commands/deploy/spec/getDeployScripts.spec.js +8 -8
- package/build/commands/deploy/spec/utils.js +17 -17
- package/build/commands/docs/docsCommand.js +7 -7
- package/build/commands/docs/generateDocs.js +33 -29
- package/build/commands/docs/generateDot.js +12 -8
- package/build/commands/docs/initDocs.js +1 -1
- package/build/commands/docs/internal/createDotFiles.js +6 -6
- package/build/commands/docs/internal/getDotFileContent.js +17 -17
- package/build/commands/docs/internal/getFileInputs.js +1 -1
- package/build/commands/docs/internal/getFileOutputs.js +1 -1
- package/build/commands/docs/internal/getFoldersForDocs.js +4 -4
- package/build/commands/docs/internal/populateNodeDictionary.js +1 -1
- package/build/commands/docs/spec/docsCommand.spec.js +25 -21
- package/build/commands/docs/spec/generateDocs.spec.js +60 -60
- package/build/commands/docs/spec/generateDot.spec.js +23 -23
- package/build/commands/docs/spec/getDocConfig.spec.js +2 -2
- package/build/commands/docs/spec/initDocs.spec.js +7 -7
- package/build/commands/flow/execute.js +8 -8
- package/build/commands/flow/flowCommand.js +5 -5
- package/build/commands/flow/internal/checkPredecessorDeadlock.js +11 -7
- package/build/commands/flow/internal/executeFlow.js +23 -23
- package/build/commands/flow/internal/failAllSuccessors.js +1 -1
- package/build/commands/flow/internal/generateFileName.js +2 -2
- package/build/commands/flow/internal/normalizeFilePath.js +1 -1
- package/build/commands/flow/internal/parseJobDetails.js +3 -3
- package/build/commands/flow/internal/printError.js +1 -1
- package/build/commands/flow/internal/saveLog.js +8 -8
- package/build/commands/flow/internal/saveToCsv.js +2 -2
- package/build/commands/flow/internal/spec/allFlowsCompleted.spec.js +4 -4
- package/build/commands/flow/internal/spec/checkPredecessorDeadlock.spec.js +4 -4
- package/build/commands/flow/internal/spec/executeFlow.spec.js +10 -10
- package/build/commands/flow/internal/spec/failAllSuccessors.spec.js +1 -1
- package/build/commands/flow/internal/spec/saveToCsv.spec.js +16 -16
- package/build/commands/flow/internal/spec/validateParams.spec.js +33 -33
- package/build/commands/flow/internal/validateParams.js +17 -17
- package/build/commands/flow/spec/flow.spec.js +1 -1
- package/build/commands/flow/spec/flow.spec.server.js +60 -60
- package/build/commands/flow/spec/flowCommand.spec.js +16 -12
- package/build/commands/folder/create.js +2 -2
- package/build/commands/folder/delete.js +2 -2
- package/build/commands/folder/folderCommand.js +11 -11
- package/build/commands/folder/move.js +2 -2
- package/build/commands/folder/spec/folder.spec.server.js +35 -35
- package/build/commands/folder/spec/folderCommand.spec.js +23 -19
- package/build/commands/help/help.js +46 -46
- package/build/commands/help/helpCommand.js +1 -1
- package/build/commands/help/spec/help.spec.js +8 -8
- package/build/commands/help/spec/helpCommand.spec.js +11 -7
- package/build/commands/init/init.js +7 -7
- package/build/commands/init/initCommand.js +1 -1
- package/build/commands/init/spec/init.spec.server.js +17 -17
- package/build/commands/init/spec/initCommand.spec.js +11 -7
- package/build/commands/job/internal/execute/sasjs.js +1 -1
- package/build/commands/job/internal/execute/viya.js +35 -35
- package/build/commands/job/internal/utils.js +6 -6
- package/build/commands/job/jobCommand.js +6 -6
- package/build/commands/job/spec/execute.spec.js +6 -6
- package/build/commands/job/spec/getContextName.spec.js +2 -2
- package/build/commands/job/spec/job.spec.server.js +53 -53
- package/build/commands/job/spec/jobCommand.spec.js +17 -13
- package/build/commands/lint/initLint.js +2 -2
- package/build/commands/lint/lintCommand.js +10 -10
- package/build/commands/lint/processLint.js +5 -5
- package/build/commands/lint/spec/lintCommand.spec.js +19 -15
- package/build/commands/request/request.js +16 -16
- package/build/commands/request/requestCommand.js +5 -5
- package/build/commands/request/spec/request.spec.server.js +71 -71
- package/build/commands/request/spec/requestCommand.spec.js +17 -13
- package/build/commands/run/run.js +23 -23
- package/build/commands/run/runCommand.js +2 -2
- package/build/commands/run/spec/run.spec.server.js +51 -51
- package/build/commands/run/spec/runCommand.spec.js +10 -6
- package/build/commands/servicepack/deploy.js +6 -6
- package/build/commands/servicepack/servicePackCommand.js +3 -3
- package/build/commands/servicepack/spec/servicepack.spec.server.js +6 -6
- package/build/commands/servicepack/spec/servicepackCommand.spec.js +10 -6
- package/build/commands/shared/createConfigFile.js +2 -2
- package/build/commands/shared/createFileStructure.js +6 -6
- package/build/commands/shared/createLintConfigFile.js +1 -1
- package/build/commands/shared/deployToSasViyaWithServicePack.js +4 -4
- package/build/commands/shared/fetchLogFileContent.js +10 -6
- package/build/commands/testing/internal/saveOutput.js +38 -34
- package/build/commands/testing/spec/testCommand.spec.js +17 -13
- package/build/commands/testing/spec/testing.spec.server.js +38 -38
- package/build/commands/testing/test.js +45 -41
- package/build/commands/testing/testCommand.js +2 -2
- package/build/commands/version/spec/version.spec.js +1 -1
- package/build/commands/version/spec/versionCommand.spec.js +11 -7
- package/build/commands/version/version.js +3 -3
- package/build/commands/version/versionCommand.js +2 -2
- package/build/commands/web/internal/createAssetServices.js +28 -24
- package/build/commands/web/internal/getWebServiceContent.js +6 -6
- package/build/commands/web/internal/sasjsout.d.ts +1 -1
- package/build/commands/web/internal/sasjsout.js +1 -1
- package/build/commands/web/internal/spec/updateLinkTag.spec.js +2 -2
- package/build/commands/web/internal/spec/updateScriptTag.spec.js +10 -10
- package/build/commands/web/internal/updateAllTags.js +19 -15
- package/build/commands/web/internal/updateLinkTag.js +2 -2
- package/build/commands/web/internal/updateScriptTag.js +6 -6
- package/build/commands/web/spec/web.spec.js +23 -23
- package/build/commands/web/spec/webCommand.spec.js +16 -12
- package/build/commands/web/web.js +25 -25
- package/build/commands/web/webCommand.js +3 -3
- package/build/types/command/commandBase.js +19 -15
- package/build/types/command/parse.js +1 -1
- package/build/types/command/spec/commandBase.spec.js +16 -12
- package/build/types/command/targetCommand.js +4 -4
- package/build/types/command/unalias.js +9 -5
- package/build/utils/auth.js +7 -7
- package/build/utils/config.js +53 -49
- package/build/utils/displayResult.js +4 -4
- package/build/utils/file.js +11 -11
- package/build/utils/fileStructures/builtFiles.js +2 -2
- package/build/utils/fileStructures/builtFilesCustom1.js +2 -2
- package/build/utils/getLogFilePath.js +1 -1
- package/build/utils/loadEnvVariables.js +3 -3
- package/build/utils/prefixAppLoc.js +1 -1
- package/build/utils/saveLog.js +7 -7
- package/build/utils/setConstants.js +4 -4
- package/build/utils/setProjectDir.js +2 -2
- package/build/utils/spec/config.spec.js +80 -80
- package/build/utils/spec/displayResult.spec.js +7 -7
- package/build/utils/spec/file.spec.js +15 -15
- package/build/utils/spec/removeComments.spec.js +11 -11
- package/build/utils/spec/setConstants.spec.js +3 -3
- package/build/utils/spec/utils.spec.js +55 -55
- package/build/utils/test.js +59 -59
- package/build/utils/utils.js +47 -43
- package/package.json +10 -10
|
@@ -5,42 +5,42 @@ var utils_1 = require("../utils");
|
|
|
5
5
|
describe('removeComments', function () {
|
|
6
6
|
test('should remove block comment', function () {
|
|
7
7
|
var text = "/* test\n123\n456\n789 */";
|
|
8
|
-
expect(utils_1.removeComments(text)).toEqual('');
|
|
8
|
+
expect((0, utils_1.removeComments)(text)).toEqual('');
|
|
9
9
|
});
|
|
10
10
|
test('should not remove single line block comment', function () {
|
|
11
11
|
var text = "/* test */";
|
|
12
|
-
expect(utils_1.removeComments(text)).toEqual(text);
|
|
12
|
+
expect((0, utils_1.removeComments)(text)).toEqual(text);
|
|
13
13
|
});
|
|
14
14
|
test('should remove all comments from the provided SAS file', function () {
|
|
15
15
|
var expected = "%macro mv_createfolder(path=\n ,access_token_var=ACCESS_TOKEN\n ,grant_type=authorization_code\n);";
|
|
16
|
-
expect(utils_1.removeComments(exports.sampleSasProgram)).toEqual(expected);
|
|
16
|
+
expect((0, utils_1.removeComments)(exports.sampleSasProgram)).toEqual(expected);
|
|
17
17
|
});
|
|
18
18
|
test('should keep inline comments intact when they start a line', function () {
|
|
19
19
|
var text = '/* Some Comment */ CODE HERE;';
|
|
20
|
-
expect(utils_1.removeComments(text)).toEqual(text);
|
|
20
|
+
expect((0, utils_1.removeComments)(text)).toEqual(text);
|
|
21
21
|
});
|
|
22
22
|
test('should keep inline comments intact when they are within a line', function () {
|
|
23
23
|
var text = 'CODE HERE /* Some Comment */';
|
|
24
|
-
expect(utils_1.removeComments(text)).toEqual(text);
|
|
24
|
+
expect((0, utils_1.removeComments)(text)).toEqual(text);
|
|
25
25
|
});
|
|
26
26
|
test('should handle CRLF line endings', function () {
|
|
27
27
|
var text = 'CODE HERE\r\n\r\nMORE CODE';
|
|
28
28
|
var expectedText = 'CODE HERE\nMORE CODE';
|
|
29
|
-
expect(utils_1.removeComments(text)).toEqual(expectedText);
|
|
29
|
+
expect((0, utils_1.removeComments)(text)).toEqual(expectedText);
|
|
30
30
|
});
|
|
31
31
|
test('should handle a mix of CRLF and LF line endings', function () {
|
|
32
32
|
var text = 'CODE HERE\r\n\r\nMORE CODE\nEVEN MORE CODE';
|
|
33
33
|
var expectedText = 'CODE HERE\nMORE CODE\nEVEN MORE CODE';
|
|
34
|
-
expect(utils_1.removeComments(text)).toEqual(expectedText);
|
|
34
|
+
expect((0, utils_1.removeComments)(text)).toEqual(expectedText);
|
|
35
35
|
});
|
|
36
36
|
test('should return an empty string when the input is falsy', function () {
|
|
37
|
-
expect(utils_1.removeComments(null)).toEqual('');
|
|
38
|
-
expect(utils_1.removeComments(undefined)).toEqual('');
|
|
39
|
-
expect(utils_1.removeComments('')).toEqual('');
|
|
37
|
+
expect((0, utils_1.removeComments)(null)).toEqual('');
|
|
38
|
+
expect((0, utils_1.removeComments)(undefined)).toEqual('');
|
|
39
|
+
expect((0, utils_1.removeComments)('')).toEqual('');
|
|
40
40
|
});
|
|
41
41
|
test('should preserve formatting when removing comments', function () {
|
|
42
42
|
var text = "if (this === 'code') {\n console.log('Pigs can fly.')\n }";
|
|
43
|
-
expect(utils_1.removeComments(text)).toEqual(text);
|
|
43
|
+
expect((0, utils_1.removeComments)(text)).toEqual(text);
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
46
|
exports.sampleSasProgram = "/**\n @file mv_createfolder.sas\n @brief Creates a viya folder if that foloder does not already exist\n @details Expects oauth token in a global macro variable (default\n ACCESS_TOKEN).\n\n options mprint;\n %mv_createfolder(path=/Public)\n\n\n @param path= The full path of the folder to be created\n @param access_token_var= The global macro variable to contain the access token\n @param grant_type= valid values are \"password\" or \"authorization_code\" (unquoted).\n The default is authorization_code.\n\n\n @version VIYA V.03.04\n @author Allan Bowe\n @source https://github.com/sasjs/core\n\n <h4> SAS Macros </h4>\n @li mf_abort.sas\n @li mf_getuniquefileref.sas\n @li mf_getuniquelibref.sas\n @li mf_isblank.sas\n\n**/\n\n/* This is a comment\nthat spans\nmultiple lines */\n\n%macro mv_createfolder(path=\n ,access_token_var=ACCESS_TOKEN\n ,grant_type=authorization_code\n);";
|
|
@@ -71,7 +71,7 @@ describe('setConstants', function () {
|
|
|
71
71
|
case 0:
|
|
72
72
|
;
|
|
73
73
|
_b = (_a = JSON).parse;
|
|
74
|
-
return [4 /*yield*/, utils_1.readFile(path_1.default.join(__dirname, '..', '..', 'config.json'))];
|
|
74
|
+
return [4 /*yield*/, (0, utils_1.readFile)(path_1.default.join(__dirname, '..', '..', 'config.json'))];
|
|
75
75
|
case 1:
|
|
76
76
|
(config = _b.apply(_a, [_c.sent()]).config);
|
|
77
77
|
return [2 /*return*/];
|
|
@@ -93,7 +93,7 @@ describe('setConstants', function () {
|
|
|
93
93
|
});
|
|
94
94
|
}); });
|
|
95
95
|
process.projectDir = ['some', 'app', 'folder'].join(path_1.default.sep);
|
|
96
|
-
return [4 /*yield*/, setConstants_1.setConstants()];
|
|
96
|
+
return [4 /*yield*/, (0, setConstants_1.setConstants)()];
|
|
97
97
|
case 1:
|
|
98
98
|
_a.sent();
|
|
99
99
|
verifySasjsConstants(process.projectDir);
|
|
@@ -115,7 +115,7 @@ describe('setConstants', function () {
|
|
|
115
115
|
})];
|
|
116
116
|
});
|
|
117
117
|
}); });
|
|
118
|
-
return [4 /*yield*/, setConstants_1.setConstants()];
|
|
118
|
+
return [4 /*yield*/, (0, setConstants_1.setConstants)()];
|
|
119
119
|
case 1:
|
|
120
120
|
_a.sent();
|
|
121
121
|
verifySasjsConstants();
|
|
@@ -77,25 +77,25 @@ describe('utils', function () {
|
|
|
77
77
|
}
|
|
78
78
|
]
|
|
79
79
|
};
|
|
80
|
-
expect(utils_1.parseLogLines(json)).toEqual(expectedLog);
|
|
80
|
+
expect((0, utils_1.parseLogLines)(json)).toEqual(expectedLog);
|
|
81
81
|
});
|
|
82
82
|
});
|
|
83
83
|
describe('millisecondsToDdHhMmSs', function () {
|
|
84
84
|
it('should throw an error if not supported type was provided', function () {
|
|
85
85
|
var error = new Error('Not supported attribute type.');
|
|
86
|
-
expect(function () { return utils_1.millisecondsToDdHhMmSs(undefined); }).toThrow(error);
|
|
86
|
+
expect(function () { return (0, utils_1.millisecondsToDdHhMmSs)(undefined); }).toThrow(error);
|
|
87
87
|
});
|
|
88
88
|
it('should process negative number', function () {
|
|
89
|
-
expect(utils_1.millisecondsToDdHhMmSs(-1000)).toEqual('0 day(s); 0 hour(s); 0 minute(s); 1 second(s)');
|
|
89
|
+
expect((0, utils_1.millisecondsToDdHhMmSs)(-1000)).toEqual('0 day(s); 0 hour(s); 0 minute(s); 1 second(s)');
|
|
90
90
|
});
|
|
91
91
|
it('should process 0', function () {
|
|
92
|
-
expect(utils_1.millisecondsToDdHhMmSs(0)).toEqual('0 day(s); 0 hour(s); 0 minute(s); 0 second(s)');
|
|
92
|
+
expect((0, utils_1.millisecondsToDdHhMmSs)(0)).toEqual('0 day(s); 0 hour(s); 0 minute(s); 0 second(s)');
|
|
93
93
|
});
|
|
94
94
|
it('should process number with floating point', function () {
|
|
95
|
-
expect(utils_1.millisecondsToDdHhMmSs(8 * 60 * 60 * 1000 + 0.93326263)).toEqual('0 day(s); 8 hour(s); 0 minute(s); 0 second(s)');
|
|
95
|
+
expect((0, utils_1.millisecondsToDdHhMmSs)(8 * 60 * 60 * 1000 + 0.93326263)).toEqual('0 day(s); 8 hour(s); 0 minute(s); 0 second(s)');
|
|
96
96
|
});
|
|
97
97
|
it('should process number', function () {
|
|
98
|
-
expect(utils_1.millisecondsToDdHhMmSs(24 * 60 * 60 * 1000)).toEqual('1 day(s); 0 hour(s); 0 minute(s); 0 second(s)');
|
|
98
|
+
expect((0, utils_1.millisecondsToDdHhMmSs)(24 * 60 * 60 * 1000)).toEqual('1 day(s); 0 hour(s); 0 minute(s); 0 second(s)');
|
|
99
99
|
});
|
|
100
100
|
});
|
|
101
101
|
describe('inExistingProject', function () {
|
|
@@ -105,17 +105,17 @@ describe('utils', function () {
|
|
|
105
105
|
switch (_a.label) {
|
|
106
106
|
case 0:
|
|
107
107
|
process.projectDir = process.cwd();
|
|
108
|
-
return [4 /*yield*/, __1.setConstants()];
|
|
108
|
+
return [4 /*yield*/, (0, __1.setConstants)()];
|
|
109
109
|
case 1:
|
|
110
110
|
_a.sent();
|
|
111
111
|
packagePath = path_1.default.join(process.projectDir, folderPath, 'package.json');
|
|
112
|
-
return [4 /*yield*/, utils_2.createFile(packagePath, '{}')];
|
|
112
|
+
return [4 /*yield*/, (0, utils_2.createFile)(packagePath, '{}')];
|
|
113
113
|
case 2:
|
|
114
114
|
_a.sent();
|
|
115
|
-
return [4 /*yield*/, expect(utils_1.inExistingProject(folderPath)).resolves.toEqual(true)];
|
|
115
|
+
return [4 /*yield*/, expect((0, utils_1.inExistingProject)(folderPath)).resolves.toEqual(true)];
|
|
116
116
|
case 3:
|
|
117
117
|
_a.sent();
|
|
118
|
-
return [4 /*yield*/, utils_2.deleteFile(packagePath)];
|
|
118
|
+
return [4 /*yield*/, (0, utils_2.deleteFile)(packagePath)];
|
|
119
119
|
case 4:
|
|
120
120
|
_a.sent();
|
|
121
121
|
return [2 /*return*/];
|
|
@@ -125,7 +125,7 @@ describe('utils', function () {
|
|
|
125
125
|
it('should return false if package.json does not exist in folder', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
126
126
|
return __generator(this, function (_a) {
|
|
127
127
|
switch (_a.label) {
|
|
128
|
-
case 0: return [4 /*yield*/, expect(utils_1.inExistingProject(folderPath)).resolves.toEqual(false)];
|
|
128
|
+
case 0: return [4 /*yield*/, expect((0, utils_1.inExistingProject)(folderPath)).resolves.toEqual(false)];
|
|
129
129
|
case 1:
|
|
130
130
|
_a.sent();
|
|
131
131
|
return [2 /*return*/];
|
|
@@ -135,25 +135,25 @@ describe('utils', function () {
|
|
|
135
135
|
});
|
|
136
136
|
describe('diff', function () {
|
|
137
137
|
it('should return an array of differences', function () {
|
|
138
|
-
expect(utils_1.diff([1, 2, 3], [2])).toEqual([1, 3]);
|
|
139
|
-
expect(utils_1.diff(['b'], ['a', 'b', 'c'])).toEqual(['a', 'c']);
|
|
140
|
-
expect(utils_1.diff([{}, { test: 1 }], [{}])).toEqual([{ test: 1 }]);
|
|
141
|
-
expect(utils_1.diff([[1], []], [[]])).toEqual([[1]]);
|
|
142
|
-
expect(utils_1.diff([null, NaN, undefined], [[]])).toEqual([
|
|
138
|
+
expect((0, utils_1.diff)([1, 2, 3], [2])).toEqual([1, 3]);
|
|
139
|
+
expect((0, utils_1.diff)(['b'], ['a', 'b', 'c'])).toEqual(['a', 'c']);
|
|
140
|
+
expect((0, utils_1.diff)([{}, { test: 1 }], [{}])).toEqual([{ test: 1 }]);
|
|
141
|
+
expect((0, utils_1.diff)([[1], []], [[]])).toEqual([[1]]);
|
|
142
|
+
expect((0, utils_1.diff)([null, NaN, undefined], [[]])).toEqual([
|
|
143
143
|
null,
|
|
144
144
|
NaN,
|
|
145
145
|
undefined,
|
|
146
146
|
[]
|
|
147
147
|
]);
|
|
148
|
-
expect(utils_1.diff([true], [false])).toEqual([true, false]);
|
|
148
|
+
expect((0, utils_1.diff)([true], [false])).toEqual([true, false]);
|
|
149
149
|
});
|
|
150
150
|
it('should return an empty array if provided two equal arrays', function () {
|
|
151
|
-
expect(utils_1.diff([2], [2])).toEqual([]);
|
|
152
|
-
expect(utils_1.diff(['b'], ['b'])).toEqual([]);
|
|
153
|
-
expect(utils_1.diff([{}], [{}])).toEqual([]);
|
|
154
|
-
expect(utils_1.diff([[]], [[]])).toEqual([]);
|
|
155
|
-
expect(utils_1.diff([null, NaN, undefined], [null, NaN, undefined])).toEqual([]);
|
|
156
|
-
expect(utils_1.diff([true], [true])).toEqual([]);
|
|
151
|
+
expect((0, utils_1.diff)([2], [2])).toEqual([]);
|
|
152
|
+
expect((0, utils_1.diff)(['b'], ['b'])).toEqual([]);
|
|
153
|
+
expect((0, utils_1.diff)([{}], [{}])).toEqual([]);
|
|
154
|
+
expect((0, utils_1.diff)([[]], [[]])).toEqual([]);
|
|
155
|
+
expect((0, utils_1.diff)([null, NaN, undefined], [null, NaN, undefined])).toEqual([]);
|
|
156
|
+
expect((0, utils_1.diff)([true], [true])).toEqual([]);
|
|
157
157
|
});
|
|
158
158
|
});
|
|
159
159
|
describe('setupGitIgnore', function () {
|
|
@@ -161,7 +161,7 @@ describe('utils', function () {
|
|
|
161
161
|
beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
162
162
|
return __generator(this, function (_a) {
|
|
163
163
|
switch (_a.label) {
|
|
164
|
-
case 0: return [4 /*yield*/, __1.setConstants()];
|
|
164
|
+
case 0: return [4 /*yield*/, (0, __1.setConstants)()];
|
|
165
165
|
case 1:
|
|
166
166
|
_a.sent();
|
|
167
167
|
return [2 /*return*/];
|
|
@@ -173,17 +173,17 @@ describe('utils', function () {
|
|
|
173
173
|
var gitIgnoreContent;
|
|
174
174
|
return __generator(this, function (_a) {
|
|
175
175
|
switch (_a.label) {
|
|
176
|
-
case 0: return [4 /*yield*/, expect(utils_1.setupGitIgnore(folderPath)).toResolve()];
|
|
176
|
+
case 0: return [4 /*yield*/, expect((0, utils_1.setupGitIgnore)(folderPath)).toResolve()];
|
|
177
177
|
case 1:
|
|
178
178
|
_a.sent();
|
|
179
|
-
return [4 /*yield*/, expect(utils_2.fileExists(gitFilePath)).resolves.toEqual(true)];
|
|
179
|
+
return [4 /*yield*/, expect((0, utils_2.fileExists)(gitFilePath)).resolves.toEqual(true)];
|
|
180
180
|
case 2:
|
|
181
181
|
_a.sent();
|
|
182
|
-
return [4 /*yield*/, utils_2.readFile(gitFilePath)];
|
|
182
|
+
return [4 /*yield*/, (0, utils_2.readFile)(gitFilePath)];
|
|
183
183
|
case 3:
|
|
184
184
|
gitIgnoreContent = _a.sent();
|
|
185
185
|
expect(gitIgnoreContent.includes('sasjsbuild/')).toEqual(true);
|
|
186
|
-
return [4 /*yield*/, utils_2.deleteFile(gitFilePath)];
|
|
186
|
+
return [4 /*yield*/, (0, utils_2.deleteFile)(gitFilePath)];
|
|
187
187
|
case 4:
|
|
188
188
|
_a.sent();
|
|
189
189
|
return [2 /*return*/];
|
|
@@ -196,14 +196,14 @@ describe('utils', function () {
|
|
|
196
196
|
switch (_a.label) {
|
|
197
197
|
case 0:
|
|
198
198
|
gitIgnoreContent = 'node_modules/';
|
|
199
|
-
return [4 /*yield*/, utils_2.createFile(gitFilePath, gitIgnoreContent)];
|
|
199
|
+
return [4 /*yield*/, (0, utils_2.createFile)(gitFilePath, gitIgnoreContent)];
|
|
200
200
|
case 1:
|
|
201
201
|
_a.sent();
|
|
202
|
-
return [4 /*yield*/, expect(utils_1.setupGitIgnore(folderPath)).toResolve()];
|
|
202
|
+
return [4 /*yield*/, expect((0, utils_1.setupGitIgnore)(folderPath)).toResolve()];
|
|
203
203
|
case 2:
|
|
204
204
|
_a.sent();
|
|
205
205
|
regExp = new RegExp("^node_modules/\nsasjsbuild/\n", 'gm');
|
|
206
|
-
return [4 /*yield*/, utils_2.readFile(gitFilePath)];
|
|
206
|
+
return [4 /*yield*/, (0, utils_2.readFile)(gitFilePath)];
|
|
207
207
|
case 3:
|
|
208
208
|
gitIgnoreContent = _a.sent();
|
|
209
209
|
expect(gitIgnoreContent.match(regExp)).toBeTruthy();
|
|
@@ -215,16 +215,16 @@ describe('utils', function () {
|
|
|
215
215
|
var gitIgnoreContent, regExp;
|
|
216
216
|
return __generator(this, function (_a) {
|
|
217
217
|
switch (_a.label) {
|
|
218
|
-
case 0: return [4 /*yield*/, utils_2.readFile(gitFilePath)];
|
|
218
|
+
case 0: return [4 /*yield*/, (0, utils_2.readFile)(gitFilePath)];
|
|
219
219
|
case 1:
|
|
220
220
|
gitIgnoreContent = _a.sent();
|
|
221
|
-
return [4 /*yield*/, expect(utils_1.setupGitIgnore(folderPath)).toResolve()];
|
|
221
|
+
return [4 /*yield*/, expect((0, utils_1.setupGitIgnore)(folderPath)).toResolve()];
|
|
222
222
|
case 2:
|
|
223
223
|
_a.sent();
|
|
224
224
|
regExp = new RegExp("^sasjsbuild/", 'gm');
|
|
225
225
|
expect(gitIgnoreContent.match(regExp)).toBeTruthy();
|
|
226
226
|
expect(gitIgnoreContent.match(regExp).length).toEqual(1);
|
|
227
|
-
return [4 /*yield*/, utils_2.deleteFile(gitFilePath)];
|
|
227
|
+
return [4 /*yield*/, (0, utils_2.deleteFile)(gitFilePath)];
|
|
228
228
|
case 3:
|
|
229
229
|
_a.sent();
|
|
230
230
|
return [2 /*return*/];
|
|
@@ -235,17 +235,17 @@ describe('utils', function () {
|
|
|
235
235
|
describe('chunk', function () {
|
|
236
236
|
it('should return an array with only one element that is equal to text itself if text size is less than max length', function () {
|
|
237
237
|
var txt = '0B0pFTOzHXyRuikRydwnd8uQdwvITllwNOX20vQLsT0JgkXa1W';
|
|
238
|
-
expect(utils_2.chunk(txt)[0]).toBe(txt);
|
|
238
|
+
expect((0, utils_2.chunk)(txt)[0]).toBe(txt);
|
|
239
239
|
});
|
|
240
240
|
it('should return an array with 3 elements', function () {
|
|
241
241
|
var txt = 'SGmqg3pnHCJn0iPQC4Rd9AnFS3k5V7dDc81GlF6lCCurmsEJq7VS\nig42yjxerV7OAjE1HIOgJZXqID30\nkaVJsCwWrtFEIL8mQepjp4zLGeCaWk7ymu9BqolSnqA3udaiWuHcm6m80E36mWYWU0lITAgdp1QzVwIczpopXRaUWtJamiPnHyflksdNEXkboKlAT5RuR795ShUOc6KajQZ1qH2ZGJPV2DxjEqtXA9uvNbpisOVY6MpRdEzWNgdDsXlfuXkrBk5RqA7PkdtjBtNHA7JtEklTnYKrOdge03qFXKjh';
|
|
242
|
-
expect(utils_2.chunk(txt)).toBeArrayOfSize(3);
|
|
242
|
+
expect((0, utils_2.chunk)(txt)).toBeArrayOfSize(3);
|
|
243
243
|
});
|
|
244
244
|
});
|
|
245
245
|
describe('arrToObj', function () {
|
|
246
246
|
it('should return an object', function () {
|
|
247
247
|
var arr = ['a', 'b', 'c'];
|
|
248
|
-
expect(utils_1.arrToObj(arr)).toEqual({
|
|
248
|
+
expect((0, utils_1.arrToObj)(arr)).toEqual({
|
|
249
249
|
a: 'a',
|
|
250
250
|
b: 'b',
|
|
251
251
|
c: 'c'
|
|
@@ -259,34 +259,34 @@ describe('utils', function () {
|
|
|
259
259
|
it('should exit the process when node version is less than 12', function () {
|
|
260
260
|
var originalProcess = global.process;
|
|
261
261
|
global.process = __assign(__assign({}, originalProcess), { versions: __assign(__assign({}, originalProcess.versions), { node: '11.0.0' }) });
|
|
262
|
-
var mockExit = test_1.mockProcessExit();
|
|
263
|
-
utils_1.checkNodeVersion();
|
|
262
|
+
var mockExit = (0, test_1.mockProcessExit)();
|
|
263
|
+
(0, utils_1.checkNodeVersion)();
|
|
264
264
|
expect(mockExit).toHaveBeenCalledWith(1);
|
|
265
265
|
global.process = originalProcess;
|
|
266
266
|
});
|
|
267
267
|
it('should not exit the process when node version greater than 12', function () {
|
|
268
268
|
jest.spyOn(process, 'exit');
|
|
269
|
-
utils_1.checkNodeVersion();
|
|
269
|
+
(0, utils_1.checkNodeVersion)();
|
|
270
270
|
expect(process.exit).toHaveBeenCalledTimes(0);
|
|
271
271
|
});
|
|
272
272
|
});
|
|
273
273
|
describe('getAdapterInstance', function () {
|
|
274
274
|
it('should throw an error when target is not valid', function () {
|
|
275
|
-
expect(function () { return utils_1.getAdapterInstance(null); }).toThrow('Unable to create SASjs adapter instance: Invalid target.');
|
|
275
|
+
expect(function () { return (0, utils_1.getAdapterInstance)(null); }).toThrow('Unable to create SASjs adapter instance: Invalid target.');
|
|
276
276
|
});
|
|
277
277
|
it('should throw an error when target is missing serverUrl', function () {
|
|
278
|
-
expect(function () { return utils_1.getAdapterInstance({ name: 'test-target' }); }).toThrow("Unable to create SASjs adapter instance: Target test-target is missing a `serverUrl`.");
|
|
278
|
+
expect(function () { return (0, utils_1.getAdapterInstance)({ name: 'test-target' }); }).toThrow("Unable to create SASjs adapter instance: Target test-target is missing a `serverUrl`.");
|
|
279
279
|
});
|
|
280
280
|
it('should throw an error when target is missing serverType', function () {
|
|
281
281
|
expect(function () {
|
|
282
|
-
return utils_1.getAdapterInstance({
|
|
282
|
+
return (0, utils_1.getAdapterInstance)({
|
|
283
283
|
name: 'test-target',
|
|
284
284
|
serverUrl: 'http://server.com'
|
|
285
285
|
});
|
|
286
286
|
}).toThrow("Unable to create SASjs adapter instance: Target test-target is missing a `serverType`.");
|
|
287
287
|
});
|
|
288
288
|
it('should return an instance of SASjs', function () {
|
|
289
|
-
expect(utils_1.getAdapterInstance({
|
|
289
|
+
expect((0, utils_1.getAdapterInstance)({
|
|
290
290
|
name: 'test-target',
|
|
291
291
|
serverUrl: 'http://server.com',
|
|
292
292
|
serverType: utils_2.ServerType.SasViya,
|
|
@@ -307,22 +307,22 @@ describe('utils', function () {
|
|
|
307
307
|
var relativePath = './my-path/xyz';
|
|
308
308
|
var pathRelativeTo = '/home/abc';
|
|
309
309
|
var expectedAbsolutePath = ['', 'home', 'abc', 'my-path', 'xyz'].join(path_1.default.sep);
|
|
310
|
-
expect(utils_2.getAbsolutePath(relativePath, pathRelativeTo)).toEqual(expectedAbsolutePath);
|
|
310
|
+
expect((0, utils_2.getAbsolutePath)(relativePath, pathRelativeTo)).toEqual(expectedAbsolutePath);
|
|
311
311
|
});
|
|
312
312
|
it('should convert tilde from absolute path', function () {
|
|
313
313
|
var relativePath = '~/my-path/xyz';
|
|
314
314
|
var expectedAbsolutePath = homedir + ['', 'my-path', 'xyz'].join(path_1.default.sep);
|
|
315
|
-
expect(utils_2.getAbsolutePath(relativePath, '')).toEqual(expectedAbsolutePath);
|
|
315
|
+
expect((0, utils_2.getAbsolutePath)(relativePath, '')).toEqual(expectedAbsolutePath);
|
|
316
316
|
});
|
|
317
317
|
it('should return same path if path is absolute', function () {
|
|
318
318
|
var absolutePath = '/my-path/xyz';
|
|
319
319
|
var pathRelativeTo = '/home/abc';
|
|
320
320
|
var expectedAbsolutePath = ['', 'my-path', 'xyz'].join(path_1.default.sep);
|
|
321
|
-
expect(utils_2.getAbsolutePath(absolutePath, pathRelativeTo)).toEqual(expectedAbsolutePath);
|
|
321
|
+
expect((0, utils_2.getAbsolutePath)(absolutePath, pathRelativeTo)).toEqual(expectedAbsolutePath);
|
|
322
322
|
});
|
|
323
323
|
});
|
|
324
324
|
describe('loadEnvVariables', function () {
|
|
325
|
-
var fileName = ".env."
|
|
325
|
+
var fileName = ".env.".concat((0, utils_2.generateTimestamp)());
|
|
326
326
|
var filePath = path_1.default.join(process.projectDir, fileName);
|
|
327
327
|
beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
328
328
|
var fileContent;
|
|
@@ -330,7 +330,7 @@ describe('utils', function () {
|
|
|
330
330
|
switch (_a.label) {
|
|
331
331
|
case 0:
|
|
332
332
|
fileContent = 'TEST=this is test variable';
|
|
333
|
-
return [4 /*yield*/, utils_2.createFile(filePath, fileContent)];
|
|
333
|
+
return [4 /*yield*/, (0, utils_2.createFile)(filePath, fileContent)];
|
|
334
334
|
case 1:
|
|
335
335
|
_a.sent();
|
|
336
336
|
return [2 /*return*/];
|
|
@@ -340,7 +340,7 @@ describe('utils', function () {
|
|
|
340
340
|
afterEach(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
341
341
|
return __generator(this, function (_a) {
|
|
342
342
|
switch (_a.label) {
|
|
343
|
-
case 0: return [4 /*yield*/, utils_2.deleteFile(filePath)];
|
|
343
|
+
case 0: return [4 /*yield*/, (0, utils_2.deleteFile)(filePath)];
|
|
344
344
|
case 1:
|
|
345
345
|
_a.sent();
|
|
346
346
|
return [2 /*return*/];
|
|
@@ -350,7 +350,7 @@ describe('utils', function () {
|
|
|
350
350
|
it('should load the environment variables from provided file', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
351
351
|
return __generator(this, function (_a) {
|
|
352
352
|
switch (_a.label) {
|
|
353
|
-
case 0: return [4 /*yield*/, utils_1.loadEnvVariables(fileName)];
|
|
353
|
+
case 0: return [4 /*yield*/, (0, utils_1.loadEnvVariables)(fileName)];
|
|
354
354
|
case 1:
|
|
355
355
|
_a.sent();
|
|
356
356
|
expect(process.env.TEST).toBe('this is test variable');
|
|
@@ -368,16 +368,16 @@ describe('utils', function () {
|
|
|
368
368
|
reactFolder = 'react-seed-app';
|
|
369
369
|
reactFolderPath = path_1.default.join(__dirname, reactFolder);
|
|
370
370
|
sasjsFolderPath = path_1.default.join(reactFolderPath, 'sasjs');
|
|
371
|
-
return [4 /*yield*/, utils_2.createFolder(reactFolderPath)];
|
|
371
|
+
return [4 /*yield*/, (0, utils_2.createFolder)(reactFolderPath)];
|
|
372
372
|
case 1:
|
|
373
373
|
_a.sent();
|
|
374
|
-
return [4 /*yield*/, expect(utils_1.createReactApp(reactFolderPath)).toResolve()];
|
|
374
|
+
return [4 /*yield*/, expect((0, utils_1.createReactApp)(reactFolderPath)).toResolve()];
|
|
375
375
|
case 2:
|
|
376
376
|
_a.sent();
|
|
377
|
-
return [4 /*yield*/, expect(utils_2.folderExists(sasjsFolderPath)).resolves.toEqual(true)];
|
|
377
|
+
return [4 /*yield*/, expect((0, utils_2.folderExists)(sasjsFolderPath)).resolves.toEqual(true)];
|
|
378
378
|
case 3:
|
|
379
379
|
_a.sent();
|
|
380
|
-
return [4 /*yield*/, utils_2.deleteFolder(reactFolderPath)];
|
|
380
|
+
return [4 /*yield*/, (0, utils_2.deleteFolder)(reactFolderPath)];
|
|
381
381
|
case 4:
|
|
382
382
|
_a.sent();
|
|
383
383
|
return [2 /*return*/];
|