@speedkit/cli 2.26.0 → 2.28.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/CHANGELOG.md +25 -0
- package/README.md +1 -1
- package/dist/models/files.d.ts +4 -0
- package/dist/models/files.js +4 -0
- package/dist/services/cli/error/cli-type-error.d.ts +1 -2
- package/dist/services/cli/error/cli-type-error.js +1 -3
- package/dist/services/config-api/context/config-api-context.d.ts +1 -2
- package/dist/services/config-api/factory/config-api-service-factory.js +1 -2
- package/dist/services/config-api/interface/config-api-context-interface.d.ts +1 -2
- package/dist/services/customer-config/customer-config-service.js +0 -3
- package/dist/services/customer-config/templates/config_documentHandler.js.hbs +0 -4
- package/dist/services/deploy/checks/post-deploy/save-files-check.d.ts +1 -1
- package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +1 -2
- package/dist/services/deploy/deploy-service-factory.js +3 -4
- package/dist/services/deploy/deploy-service.d.ts +3 -2
- package/dist/services/deploy/deploy-service.js +23 -1
- package/dist/services/deploy/handler/customer-config-handler.d.ts +4 -5
- package/dist/services/deploy/handler/customer-config-handler.js +2 -2
- package/dist/services/deploy/handler/install-resource-handler.d.ts +3 -4
- package/dist/services/deploy/handler/install-resource-handler.js +2 -3
- package/dist/services/deploy/handler/module-handler.d.ts +8 -5
- package/dist/services/deploy/handler/module-handler.js +2 -3
- package/dist/services/deploy/handler/server-config-handler.d.ts +9 -6
- package/dist/services/deploy/handler/server-config-handler.js +6 -4
- package/dist/services/document-handler-runtime/document-handler-runtime-service.d.ts +2 -3
- package/dist/services/document-handler-runtime/document-handler-runtime-service.js +2 -6
- package/dist/services/document-handler-runtime/document-handler-server.d.ts +1 -2
- package/dist/services/document-handler-runtime/document-handler-server.js +2 -5
- package/dist/services/document-handler-runtime/error/required-file-not-found-error.d.ts +1 -2
- package/dist/services/document-handler-runtime/error/required-file-not-found-error.js +1 -3
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -6
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +9 -18
- package/dist/services/integration-api/error/customer-config-legacy-error.d.ts +1 -2
- package/dist/services/integration-api/error/customer-config-legacy-error.js +1 -3
- package/dist/services/integration-api/error/handler/customer-config-legacy-handler.d.ts +1 -2
- package/dist/services/integration-api/error/handler/customer-config-legacy-handler.js +1 -1
- package/dist/services/integration-api/error/handler/origin-handler.d.ts +1 -2
- package/dist/services/integration-api/error/handler/origin-handler.js +1 -1
- package/dist/services/integration-api/error/origin-error.d.ts +1 -2
- package/dist/services/integration-api/error/origin-error.js +1 -3
- package/dist/services/integration-api/file-list.d.ts +3 -5
- package/dist/services/integration-api/file-list.js +6 -10
- package/dist/services/integration-api/file-reader.d.ts +14 -6
- package/dist/services/integration-api/file-reader.js +8 -8
- package/dist/services/integration-api/file-writer.d.ts +10 -2
- package/dist/services/integration-api/file-writer.js +9 -6
- package/dist/services/integration-api/handler/customer-config-handler.js +6 -8
- package/dist/services/integration-api/handler/install-resource-handler.js +3 -4
- package/dist/services/integration-api/handler/module-handler.js +2 -2
- package/dist/services/integration-api/handler/server-config-handler.js +2 -2
- package/dist/services/integration-api/index.d.ts +3 -0
- package/dist/services/integration-api/index.js +6 -0
- package/dist/services/integration-api/integration-api-factory.d.ts +13 -0
- package/dist/services/integration-api/integration-api-factory.js +50 -0
- package/dist/services/integration-api/integration-api-model.d.ts +33 -14
- package/dist/services/integration-api/integration-api-model.js +37 -0
- package/dist/services/integration-api/integration-api-service.d.ts +1 -2
- package/dist/services/integration-api/integration-api-service.js +3 -23
- package/dist/services/integration-api/spec/customer-config-validator.spec.d.ts +1 -0
- package/dist/services/integration-api/spec/customer-config-validator.spec.js +50 -0
- package/dist/services/integration-api/spec/file-list.spec.d.ts +1 -0
- package/dist/services/integration-api/spec/file-list.spec.js +163 -0
- package/dist/services/integration-api/spec/file-reader.spec.d.ts +1 -0
- package/dist/services/integration-api/spec/file-reader.spec.js +71 -0
- package/dist/services/integration-api/spec/file-writer.spec.d.ts +1 -0
- package/dist/services/integration-api/spec/file-writer.spec.js +55 -0
- package/dist/services/integration-api/spec/integration-api-service.spec.d.ts +1 -0
- package/dist/services/integration-api/spec/integration-api-service.spec.js +122 -0
- package/dist/services/integration-api/spec/mandatory-files-validator.spec.d.ts +1 -0
- package/dist/services/integration-api/spec/mandatory-files-validator.spec.js +105 -0
- package/dist/services/integration-api/struct/customer-config-file.d.ts +3 -4
- package/dist/services/integration-api/struct/customer-config-file.js +7 -6
- package/dist/services/integration-api/struct/customer-config.d.ts +3 -5
- package/dist/services/integration-api/struct/customer-config.js +5 -8
- package/dist/services/integration-api/struct/file.d.ts +4 -4
- package/dist/services/integration-api/struct/file.js +6 -6
- package/dist/services/integration-api/struct/install-resource-file.d.ts +4 -3
- package/dist/services/integration-api/struct/install-resource-file.js +7 -5
- package/dist/services/integration-api/struct/module-file.d.ts +4 -3
- package/dist/services/integration-api/struct/module-file.js +7 -5
- package/dist/services/integration-api/struct/ro-file.d.ts +2 -2
- package/dist/services/integration-api/struct/ro-file.js +1 -1
- package/dist/services/integration-api/struct/server-config-file.d.ts +5 -4
- package/dist/services/integration-api/struct/server-config-file.js +7 -5
- package/dist/services/integration-api/struct/virtual-file.d.ts +2 -2
- package/dist/services/integration-api/struct/virtual-file.js +2 -1
- package/dist/services/integration-api/validator/customer-config-validator.d.ts +5 -1
- package/dist/services/integration-api/validator/customer-config-validator.js +28 -17
- package/dist/services/integration-api/virtual/static-recipe.d.ts +6 -0
- package/dist/services/integration-api/virtual/static-recipe.js +14 -0
- package/dist/services/integration-api/virtual/virtual-file-handler.js +2 -2
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +1 -2
- package/dist/services/onboarding/dashboard/index.d.ts +1 -1
- package/dist/services/onboarding/dashboard/parameter-query-builder.d.ts +1 -2
- package/dist/services/onboarding/fetch-event-handler.d.ts +1 -1
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +1 -2
- package/dist/services/onboarding/fetch-events/customer-service-worker-js.d.ts +1 -1
- package/dist/services/onboarding/fetch-events/speed-kit-asset-request.d.ts +1 -1
- package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +1 -1
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +1 -2
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +1 -1
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +1 -2
- package/dist/services/onboarding/file-events/file-watcher.d.ts +1 -2
- package/dist/services/onboarding/file-events/file-watcher.js +3 -3
- package/dist/services/onboarding/onboarding-service-factory.js +9 -13
- package/dist/services/onboarding/onboarding-service.d.ts +1 -1
- package/dist/services/onboarding/todo-collector.js +2 -2
- package/dist/services/pull/pull-service-factory.js +3 -4
- package/dist/services/pull/pull-service.d.ts +1 -1
- package/dist/services/pull/pull-service.js +2 -3
- package/oclif.manifest.json +1 -1
- package/package.json +5 -5
- package/dist/services/context/error/context-runtime-error.d.ts +0 -3
- package/dist/services/context/error/context-runtime-error.js +0 -7
- package/dist/services/context/interface/context-interface.d.ts +0 -2
- package/dist/services/context/interface/context-interface.js +0 -2
- package/dist/services/customer-config/templates/deploymentDetection.es6.hbs +0 -303
- package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.d.ts +0 -6
- package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.js +0 -14
- package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.d.ts +0 -6
- package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.js +0 -19
- package/dist/services/error-handling/abstract/abstract-async-error-handling-service.d.ts +0 -6
- package/dist/services/error-handling/abstract/abstract-async-error-handling-service.js +0 -18
- package/dist/services/error-handling/abstract/abstract-error-handling-factory.d.ts +0 -6
- package/dist/services/error-handling/abstract/abstract-error-handling-factory.js +0 -19
- package/dist/services/error-handling/abstract/abstract-error-handling-service.d.ts +0 -6
- package/dist/services/error-handling/abstract/abstract-error-handling-service.js +0 -19
- package/dist/services/error-handling/error/application-error.d.ts +0 -5
- package/dist/services/error-handling/error/application-error.js +0 -11
- package/dist/services/error-handling/error-handling-service.d.ts +0 -7
- package/dist/services/error-handling/error-handling-service.js +0 -27
- package/dist/services/error-handling/factory/error-handling-factory.d.ts +0 -5
- package/dist/services/error-handling/factory/error-handling-factory.js +0 -22
- package/dist/services/error-handling/interface/error-context-interface.d.ts +0 -6
- package/dist/services/error-handling/interface/error-context-interface.js +0 -2
- package/dist/services/error-handling/interface/error-handler-interface.d.ts +0 -5
- package/dist/services/error-handling/interface/error-handler-interface.js +0 -2
- package/dist/services/error-handling/interface/error-handling-factory-interface.d.ts +0 -8
- package/dist/services/error-handling/interface/error-handling-factory-interface.js +0 -2
- package/dist/services/error-handling/interface/error-handling-service-interface.d.ts +0 -8
- package/dist/services/error-handling/interface/error-handling-service-interface.js +0 -2
- package/dist/services/integration-api/context/integration-api-context.d.ts +0 -9
- package/dist/services/integration-api/context/integration-api-context.js +0 -20
- package/dist/services/integration-api/error/handler/customer-config-handler.d.ts +0 -5
- package/dist/services/integration-api/error/handler/customer-config-handler.js +0 -19
- package/dist/services/integration-api/factory/integration-api-service-factory.d.ts +0 -13
- package/dist/services/integration-api/factory/integration-api-service-factory.js +0 -55
|
@@ -1,2 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IntegrationApiContext = exports.DEFAULT_BLOCKED_FOLDERS = exports.FILE_TYPE = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
tslib_1.__exportStar(require("./struct/customer-config"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./struct/file"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./struct/customer-config-file"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./struct/module-file"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./struct/install-resource-file"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./struct/server-config-file"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./struct/ro-file"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./struct/virtual-file"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./virtual/virtual-file-handler"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./virtual/external-recipe"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./external/external-file-reader"), exports);
|
|
16
|
+
var FILE_TYPE;
|
|
17
|
+
(function (FILE_TYPE) {
|
|
18
|
+
FILE_TYPE["CONFIG_FILE"] = "config";
|
|
19
|
+
FILE_TYPE["INSTALL_FILE"] = "install";
|
|
20
|
+
FILE_TYPE["MODULE_FILE"] = "module";
|
|
21
|
+
FILE_TYPE["SERVER_FILE"] = "server";
|
|
22
|
+
FILE_TYPE["VIRTUAL_FILE"] = "virtual";
|
|
23
|
+
FILE_TYPE["READONLY_FILE"] = "readonly";
|
|
24
|
+
FILE_TYPE["CUSTOMER_FILE"] = "customer";
|
|
25
|
+
})(FILE_TYPE || (exports.FILE_TYPE = FILE_TYPE = {}));
|
|
26
|
+
exports.DEFAULT_BLOCKED_FOLDERS = ["test", ".local", ".git", ".idea"];
|
|
27
|
+
class IntegrationApiContext {
|
|
28
|
+
basePath;
|
|
29
|
+
configName;
|
|
30
|
+
whiteList;
|
|
31
|
+
blockedFolders;
|
|
32
|
+
constructor(basePath, configName, whitelist, blockedFolders) {
|
|
33
|
+
this.basePath = basePath;
|
|
34
|
+
this.configName = configName;
|
|
35
|
+
this.whiteList = whitelist;
|
|
36
|
+
this.blockedFolders = blockedFolders || exports.DEFAULT_BLOCKED_FOLDERS;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.IntegrationApiContext = IntegrationApiContext;
|
|
@@ -3,7 +3,7 @@ import MandatoryFilesValidator from "./validator/mandatory-files-validator";
|
|
|
3
3
|
import FileWriter from "./file-writer";
|
|
4
4
|
import { FileListInterface, IntegrationApiHandler, VirtualFileConfig } from "./integration-api-model";
|
|
5
5
|
import { VirtualFileHandler } from "./virtual/virtual-file-handler";
|
|
6
|
-
export
|
|
6
|
+
export declare class IntegrationApiService {
|
|
7
7
|
private fileReader;
|
|
8
8
|
private virtualFileHandler;
|
|
9
9
|
private validator;
|
|
@@ -17,5 +17,4 @@ export default class IntegrationApiService {
|
|
|
17
17
|
createFolder(path: string): void;
|
|
18
18
|
private collectFiles;
|
|
19
19
|
private processFile;
|
|
20
|
-
private filterFilesToProcess;
|
|
21
20
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IntegrationApiService = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const file_list_1 = tslib_1.__importDefault(require("./file-list"));
|
|
5
6
|
class IntegrationApiService {
|
|
@@ -34,13 +35,12 @@ class IntegrationApiService {
|
|
|
34
35
|
this.fileWriter.mkdir(path);
|
|
35
36
|
}
|
|
36
37
|
async collectFiles() {
|
|
37
|
-
const files =
|
|
38
|
+
const files = this.fileReader.getFileList();
|
|
38
39
|
const fileList = new file_list_1.default();
|
|
39
40
|
for (const file of files) {
|
|
40
41
|
fileList.addFile(await this.processFile(file));
|
|
41
42
|
}
|
|
42
43
|
if (this.shouldValidate) {
|
|
43
|
-
this.filterFilesToProcess(fileList);
|
|
44
44
|
this.validator.validate(fileList);
|
|
45
45
|
}
|
|
46
46
|
return fileList;
|
|
@@ -54,25 +54,5 @@ class IntegrationApiService {
|
|
|
54
54
|
}
|
|
55
55
|
throw new Error(`No handler found for file: ${file}`);
|
|
56
56
|
}
|
|
57
|
-
filterFilesToProcess(fileList) {
|
|
58
|
-
fileList.filter((file) => {
|
|
59
|
-
// if we have a documentHandlerConfig we don't need an assetHandler
|
|
60
|
-
if (file.name === "speedKit.Asset" &&
|
|
61
|
-
fileList.hasFile("config_documentHandler")) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
// if we don't have a documentHandlerConfig we don't need styles
|
|
65
|
-
if (file.name === "config_dynamicStyles" &&
|
|
66
|
-
!fileList.hasFile("config_documentHandler")) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
// if we don't have a documentHandlerConfig we don't need dynamicBlocks
|
|
70
|
-
if (file.name === "config_dynamicBlocks" &&
|
|
71
|
-
!fileList.hasFile("config_documentHandler")) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
return true;
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
57
|
}
|
|
78
|
-
exports.
|
|
58
|
+
exports.IntegrationApiService = IntegrationApiService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const chai_1 = require("chai");
|
|
5
|
+
const mocha_1 = require("mocha");
|
|
6
|
+
const customer_config_validator_1 = tslib_1.__importDefault(require("../validator/customer-config-validator"));
|
|
7
|
+
const customer_config_1 = require("../struct/customer-config");
|
|
8
|
+
(0, mocha_1.describe)("customer_config_validator validate", () => {
|
|
9
|
+
(0, mocha_1.it)("should have no errors", () => {
|
|
10
|
+
const validator = new customer_config_validator_1.default();
|
|
11
|
+
const customerConfig = new customer_config_1.CustomerConfig("test", ["https://test.dev"], "test.dev", "/wrapper.sw", "/");
|
|
12
|
+
validator.validate(customerConfig);
|
|
13
|
+
(0, chai_1.expect)(true).to.be.true;
|
|
14
|
+
});
|
|
15
|
+
(0, mocha_1.it)("should throw error hasDuplicates", () => {
|
|
16
|
+
const validator = new customer_config_validator_1.default();
|
|
17
|
+
const customerConfig = new customer_config_1.CustomerConfig("test", ["https://test.dev", "https://test.dev"], "test.dev", "/wrapper.sw", "/");
|
|
18
|
+
(0, chai_1.expect)(() => {
|
|
19
|
+
validator.validate(customerConfig);
|
|
20
|
+
}).to.throw("Duplicate origins found! Remove duplicates and restart deploy!");
|
|
21
|
+
});
|
|
22
|
+
(0, mocha_1.it)("should throw error no origins", () => {
|
|
23
|
+
const validator = new customer_config_validator_1.default();
|
|
24
|
+
const customerConfig = new customer_config_1.CustomerConfig("test", [], "test.dev", "/wrapper.sw", "/");
|
|
25
|
+
(0, chai_1.expect)(() => {
|
|
26
|
+
validator.validate(customerConfig);
|
|
27
|
+
}).to.throw("No origins were found in local config_customer.js! Add origins and restart deploy!");
|
|
28
|
+
});
|
|
29
|
+
(0, mocha_1.it)("should throw error not having a protocol", () => {
|
|
30
|
+
const validator = new customer_config_validator_1.default();
|
|
31
|
+
const customerConfig = new customer_config_1.CustomerConfig("test", ["test.dev", "https://test.dev"], "test.dev", "/wrapper.sw", "/");
|
|
32
|
+
(0, chai_1.expect)(() => {
|
|
33
|
+
validator.validate(customerConfig);
|
|
34
|
+
}).to.throw("There was at least one origin configured in the local customer_config.js not having a protocol.");
|
|
35
|
+
});
|
|
36
|
+
(0, mocha_1.it)("should throw error having a path", () => {
|
|
37
|
+
const validator = new customer_config_validator_1.default();
|
|
38
|
+
const customerConfig = new customer_config_1.CustomerConfig("test", ["https://test.dev/"], "test.dev", "/wrapper.sw", "/");
|
|
39
|
+
(0, chai_1.expect)(() => {
|
|
40
|
+
validator.validate(customerConfig);
|
|
41
|
+
}).to.throw("There was at least one origin having a path. Origin must have the following format: https://domain.tld");
|
|
42
|
+
});
|
|
43
|
+
(0, mocha_1.it)("should throw error appName not start with number", () => {
|
|
44
|
+
const validator = new customer_config_validator_1.default();
|
|
45
|
+
const customerConfig = new customer_config_1.CustomerConfig("99_test", ["https://test.dev"], "test.dev", "/wrapper.sw", "/");
|
|
46
|
+
(0, chai_1.expect)(() => {
|
|
47
|
+
validator.validate(customerConfig);
|
|
48
|
+
}).to.throw("appName can't start with a number");
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const chai_1 = require("chai");
|
|
5
|
+
const mocha_1 = require("mocha");
|
|
6
|
+
const file_list_1 = tslib_1.__importDefault(require("../file-list"));
|
|
7
|
+
const __1 = require("../");
|
|
8
|
+
(0, mocha_1.describe)("fileList addFile", () => {
|
|
9
|
+
(0, mocha_1.it)("should have 1 entry", () => {
|
|
10
|
+
const fileList = new file_list_1.default();
|
|
11
|
+
fileList.addFile(new __1.VirtualFile("test", {}));
|
|
12
|
+
// Assert that our function returned the correct value
|
|
13
|
+
(0, chai_1.expect)(fileList.files.length).to.equal(1);
|
|
14
|
+
});
|
|
15
|
+
(0, mocha_1.it)("should have 2 entries", () => {
|
|
16
|
+
const fileList = new file_list_1.default();
|
|
17
|
+
fileList.addFile(new __1.VirtualFile("test", {}));
|
|
18
|
+
fileList.addFile(new __1.VirtualFile("test2", {}));
|
|
19
|
+
// Assert that our function returned the correct value
|
|
20
|
+
(0, chai_1.expect)(fileList.files.length).to.equal(2);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
(0, mocha_1.describe)("fileList hasFile", () => {
|
|
24
|
+
(0, mocha_1.it)("should return true", () => {
|
|
25
|
+
const fileList = new file_list_1.default();
|
|
26
|
+
fileList.addFile(new __1.VirtualFile("test_abcd", {}));
|
|
27
|
+
// Assert that our function returned the correct value
|
|
28
|
+
(0, chai_1.expect)(fileList.hasFile("test_abcd")).to.equal(true);
|
|
29
|
+
});
|
|
30
|
+
(0, mocha_1.it)("should return false", () => {
|
|
31
|
+
const fileList = new file_list_1.default();
|
|
32
|
+
fileList.addFile(new __1.VirtualFile("test_abcd", {}));
|
|
33
|
+
// Assert that our function returned the correct value
|
|
34
|
+
(0, chai_1.expect)(fileList.hasFile("test_xyz")).to.equal(false);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
(0, mocha_1.describe)("fileList getByType", () => {
|
|
38
|
+
(0, mocha_1.it)("should have 1 entry", () => {
|
|
39
|
+
const fileList = new file_list_1.default();
|
|
40
|
+
fileList.addFile(new __1.VirtualFile("test", {}));
|
|
41
|
+
fileList.addFile(new __1.VirtualFile("test2", {}));
|
|
42
|
+
fileList.addFile(new __1.InstallResourceFile("config_test", "/test/config_test.js", "{}", "test"));
|
|
43
|
+
// Assert that our function returned the correct value
|
|
44
|
+
(0, chai_1.expect)(fileList.getByType(__1.FILE_TYPE.VIRTUAL_FILE).length).to.equal(2);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
(0, mocha_1.describe)("fileList getByName", () => {
|
|
48
|
+
(0, mocha_1.it)("shouldn't find entry", () => {
|
|
49
|
+
const fileList = new file_list_1.default();
|
|
50
|
+
const fileToFind = new __1.VirtualFile("test", {});
|
|
51
|
+
fileList.addFile(fileToFind);
|
|
52
|
+
fileList.addFile(new __1.VirtualFile("test2", {}));
|
|
53
|
+
// Assert that our function returned the correct value
|
|
54
|
+
(0, chai_1.expect)(fileList.getByName("test4")).to.equal(undefined);
|
|
55
|
+
});
|
|
56
|
+
(0, mocha_1.it)("should find entry", () => {
|
|
57
|
+
const fileList = new file_list_1.default();
|
|
58
|
+
const fileToFind = new __1.VirtualFile("test", {});
|
|
59
|
+
fileList.addFile(fileToFind);
|
|
60
|
+
fileList.addFile(new __1.VirtualFile("test2", {}));
|
|
61
|
+
// Assert that our function returned the correct value
|
|
62
|
+
(0, chai_1.expect)(fileList.getByName("test")).to.equal(fileToFind);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
(0, mocha_1.describe)("fileList getInstallResources", () => {
|
|
66
|
+
(0, mocha_1.it)("get all installResourceFiles", () => {
|
|
67
|
+
const fileList = new file_list_1.default();
|
|
68
|
+
fileList.addFile(new __1.InstallResourceFile("config_test", "/test/config_test.js", "{}", "test"));
|
|
69
|
+
fileList.addFile(new __1.VirtualFile("custom_sw2.js", {}));
|
|
70
|
+
// Assert that our function returned the correct value
|
|
71
|
+
(0, chai_1.expect)(fileList.getInstallResources().length).to.equal(1);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
(0, mocha_1.describe)("fileList getModules", () => {
|
|
75
|
+
(0, mocha_1.it)("get all ModuleFiles", () => {
|
|
76
|
+
const fileList = new file_list_1.default();
|
|
77
|
+
fileList.addFile(new __1.ModuleFile("deploymentDetection_test", "/test/deploymentDetection_test.es6", "{}", "{}"));
|
|
78
|
+
fileList.addFile(new __1.VirtualFile("custom_sw2.js", {}));
|
|
79
|
+
// Assert that our function returned the correct value
|
|
80
|
+
(0, chai_1.expect)(fileList.getModules().length).to.equal(1);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
(0, mocha_1.describe)("fileList getServerConfig", () => {
|
|
84
|
+
(0, mocha_1.it)("get all ServerConfigFiles", () => {
|
|
85
|
+
const fileList = new file_list_1.default();
|
|
86
|
+
fileList.addFile(new __1.ServerConfigFile("config_orestes.json", "/test/config_orestes.json", "{}", "{}"));
|
|
87
|
+
fileList.addFile(new __1.VirtualFile("custom_sw2.js", {}));
|
|
88
|
+
// Assert that our function returned the correct value
|
|
89
|
+
(0, chai_1.expect)(fileList.getServerConfig().name).to.equal("config_orestes.json");
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
(0, mocha_1.describe)("fileList getCustomerConfig", () => {
|
|
93
|
+
(0, mocha_1.it)("get all CustomerConfig files", () => {
|
|
94
|
+
const fileList = new file_list_1.default();
|
|
95
|
+
fileList.addFile(new __1.CustomerConfigFile("config_customer", "/test/config_customer.js", "{}", {}, "test"));
|
|
96
|
+
fileList.addFile(new __1.VirtualFile("custom_sw2.js", {}));
|
|
97
|
+
// Assert that our function returned the correct value
|
|
98
|
+
(0, chai_1.expect)(fileList.getCustomerConfig().configName).to.equal("test");
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
(0, mocha_1.describe)("fileList getTypes", () => {
|
|
102
|
+
const fileList = new file_list_1.default();
|
|
103
|
+
fileList.addFile(new __1.CustomerConfigFile("config_customer", "/test/config_customer.js", "{}", {}, "test"));
|
|
104
|
+
fileList.addFile(new __1.VirtualFile("custom_sw.js", {}));
|
|
105
|
+
fileList.addFile(new __1.VirtualFile("custom_sw2.js", {}));
|
|
106
|
+
fileList.addFile(new __1.ModuleFile("deploymentDetection_test", "/test/deploymentDetection_test.es6", "{}", "{}"));
|
|
107
|
+
(0, mocha_1.it)("find 3 types", () => {
|
|
108
|
+
// Assert that our function returned the correct value
|
|
109
|
+
(0, chai_1.expect)(fileList.getTypes().length).to.equal(3);
|
|
110
|
+
});
|
|
111
|
+
(0, mocha_1.it)("has virtualFile", () => {
|
|
112
|
+
// Assert that our function returned the correct value
|
|
113
|
+
(0, chai_1.expect)(fileList.getTypes()).to.includes(__1.FILE_TYPE.VIRTUAL_FILE);
|
|
114
|
+
});
|
|
115
|
+
(0, mocha_1.it)("has CustomerConfigFile", () => {
|
|
116
|
+
// Assert that our function returned the correct value
|
|
117
|
+
(0, chai_1.expect)(fileList.getTypes()).to.includes(__1.FILE_TYPE.CUSTOMER_FILE);
|
|
118
|
+
});
|
|
119
|
+
(0, mocha_1.it)("has ModuleFile", () => {
|
|
120
|
+
// Assert that our function returned the correct value
|
|
121
|
+
(0, chai_1.expect)(fileList.getTypes()).to.includes(__1.FILE_TYPE.MODULE_FILE);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
(0, mocha_1.describe)("fileList filter", () => {
|
|
125
|
+
(0, mocha_1.it)("find all files name start with test", () => {
|
|
126
|
+
const fileList = new file_list_1.default();
|
|
127
|
+
fileList.addFile(new __1.VirtualFile("test1", {}));
|
|
128
|
+
fileList.addFile(new __1.VirtualFile("test2", {}));
|
|
129
|
+
fileList.addFile(new __1.VirtualFile("test3", {}));
|
|
130
|
+
fileList.addFile(new __1.VirtualFile("config", {}));
|
|
131
|
+
fileList.filter((file) => {
|
|
132
|
+
return file.name.startsWith("test");
|
|
133
|
+
});
|
|
134
|
+
// Assert that our function returned the correct value
|
|
135
|
+
(0, chai_1.expect)(fileList.files.length).to.equal(3);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
(0, mocha_1.describe)("fileList concat", () => {
|
|
139
|
+
const fileList = new file_list_1.default();
|
|
140
|
+
fileList.addFile(new __1.VirtualFile("test1", {}));
|
|
141
|
+
fileList.addFile(new __1.VirtualFile("test2", {}));
|
|
142
|
+
const fileList2 = new file_list_1.default();
|
|
143
|
+
fileList2.addFile(new __1.VirtualFile("config1", {}));
|
|
144
|
+
fileList2.addFile(new __1.VirtualFile("config2", {}));
|
|
145
|
+
// eslint-disable-next-line unicorn/prefer-spread
|
|
146
|
+
fileList.concat(fileList2);
|
|
147
|
+
(0, mocha_1.it)("check length of two filelists", () => {
|
|
148
|
+
(0, chai_1.expect)(fileList.files.length).to.equal(4);
|
|
149
|
+
});
|
|
150
|
+
(0, mocha_1.it)("find file in first fileList", () => {
|
|
151
|
+
(0, chai_1.expect)(fileList.hasFile("config2")).to.equal(true);
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
(0, mocha_1.describe)("fileList replace", () => {
|
|
155
|
+
(0, mocha_1.it)("check if file was replaced", () => {
|
|
156
|
+
const fileList = new file_list_1.default();
|
|
157
|
+
const file = new __1.VirtualFile("test1", {});
|
|
158
|
+
fileList.addFile(file);
|
|
159
|
+
const replace = new __1.InstallResourceFile("test1", "/test/config_test.js", "replace", "test");
|
|
160
|
+
fileList.replace(replace);
|
|
161
|
+
(0, chai_1.expect)(fileList.getByName("test1").path).to.equal("/test/config_test.js");
|
|
162
|
+
});
|
|
163
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const chai_1 = require("chai");
|
|
5
|
+
const mocha_1 = require("mocha");
|
|
6
|
+
const memfs_1 = require("memfs");
|
|
7
|
+
const file_reader_1 = tslib_1.__importDefault(require("../file-reader"));
|
|
8
|
+
const afterTest = () => {
|
|
9
|
+
memfs_1.vol.reset();
|
|
10
|
+
};
|
|
11
|
+
(0, mocha_1.describe)("FileReader getFileList ", () => {
|
|
12
|
+
(0, mocha_1.before)(() => {
|
|
13
|
+
memfs_1.vol.fromNestedJSON({
|
|
14
|
+
"/test_customer": {
|
|
15
|
+
"config_customer.js": "module.export = {production}",
|
|
16
|
+
"config_SpeedKit.js": "skConfig",
|
|
17
|
+
".local/test.js": "test",
|
|
18
|
+
"magic/test3.js": "test3",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
(0, mocha_1.after)(afterTest);
|
|
23
|
+
/**
|
|
24
|
+
* default behaviour
|
|
25
|
+
*/
|
|
26
|
+
(0, mocha_1.it)("fileList should include config_SpeedKit.js", () => {
|
|
27
|
+
// @ts-expect-error fs is not compatible
|
|
28
|
+
const fileReader = new file_reader_1.default(memfs_1.fs, "test", "test_customer", [], []);
|
|
29
|
+
const fileList = fileReader.getFileList("/test_customer");
|
|
30
|
+
(0, chai_1.expect)(fileList).to.include("/test_customer/config_SpeedKit.js");
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* default behaviour
|
|
34
|
+
*/
|
|
35
|
+
(0, mocha_1.it)("fileList should not include test.js", () => {
|
|
36
|
+
// @ts-expect-error fs is not compatible
|
|
37
|
+
const fileReader = new file_reader_1.default(memfs_1.fs, "test", "test_customer", [], []);
|
|
38
|
+
const fileList = fileReader.getFileList("/test_customer");
|
|
39
|
+
(0, chai_1.expect)(fileList).to.not.include("/.local/test.js");
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* add magic to blocked folders
|
|
43
|
+
*/
|
|
44
|
+
(0, mocha_1.it)("fileList should not include magic/test3.js", () => {
|
|
45
|
+
const fileReader = new file_reader_1.default(
|
|
46
|
+
// @ts-expect-error fs is not compatible
|
|
47
|
+
memfs_1.fs, "test", "test_customer", [], ["magic"]);
|
|
48
|
+
const fileList = fileReader.getFileList("/test_customer");
|
|
49
|
+
(0, chai_1.expect)(fileList).to.not.include("/magic/test3.js");
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* add asdf to whitelist
|
|
53
|
+
*/
|
|
54
|
+
(0, mocha_1.it)("fileList should include config_customer.js", () => {
|
|
55
|
+
const fileReader = new file_reader_1.default(
|
|
56
|
+
// @ts-expect-error fs is not compatible
|
|
57
|
+
memfs_1.fs, "test", "test_customer", ["asdf"], ["magic"]);
|
|
58
|
+
const fileList = fileReader.getFileList("/test_customer");
|
|
59
|
+
(0, chai_1.expect)(fileList).to.include("/test_customer/config_customer.js");
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* if whitelist is set, only files from whitelist or config_SpeedKit.js should be returned
|
|
63
|
+
*/
|
|
64
|
+
(0, mocha_1.it)("fileList should not include config_SpeedKit.js", () => {
|
|
65
|
+
const fileReader = new file_reader_1.default(
|
|
66
|
+
// @ts-expect-error fs is not compatible
|
|
67
|
+
memfs_1.fs, "test", "test_customer", ["asdf"], ["magic"]);
|
|
68
|
+
const fileList = fileReader.getFileList("/test_customer");
|
|
69
|
+
(0, chai_1.expect)(fileList).to.not.include("/test_customer/config_SpeedKit.js");
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const chai_1 = require("chai");
|
|
5
|
+
const mocha_1 = require("mocha");
|
|
6
|
+
const memfs_1 = require("memfs");
|
|
7
|
+
const file_writer_1 = tslib_1.__importDefault(require("../file-writer"));
|
|
8
|
+
const beforeTest = () => {
|
|
9
|
+
memfs_1.vol.fromNestedJSON({
|
|
10
|
+
"/test_customer/config_SpeedKit.js": "old content",
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
const afterTest = () => {
|
|
14
|
+
memfs_1.vol.reset();
|
|
15
|
+
};
|
|
16
|
+
(0, mocha_1.describe)("FileWriter writeFile ", () => {
|
|
17
|
+
(0, mocha_1.before)(beforeTest);
|
|
18
|
+
(0, mocha_1.after)(afterTest);
|
|
19
|
+
(0, mocha_1.it)("content should be written to fileSystem", () => {
|
|
20
|
+
const fileWriter = new file_writer_1.default(memfs_1.fs, "/test_customer/");
|
|
21
|
+
fileWriter.writeFile("config_SpeedKit", "js", "new content");
|
|
22
|
+
const fileContent = memfs_1.fs.readFileSync("/test_customer/config_SpeedKit.js", "utf8");
|
|
23
|
+
(0, chai_1.expect)(fileContent).to.equal("new content");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
(0, mocha_1.describe)("FileWriter mkdir ", () => {
|
|
27
|
+
(0, mocha_1.before)(beforeTest);
|
|
28
|
+
(0, mocha_1.after)(afterTest);
|
|
29
|
+
(0, mocha_1.it)("create subFolder", () => {
|
|
30
|
+
const fileWriter = new file_writer_1.default(memfs_1.fs, "/test_customer/");
|
|
31
|
+
fileWriter.mkdir("tmp");
|
|
32
|
+
(0, chai_1.expect)(memfs_1.fs.existsSync("/test_customer/tmp")).to.equal(true);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
(0, mocha_1.describe)("FileWriter hasFile ", () => {
|
|
36
|
+
(0, mocha_1.before)(beforeTest);
|
|
37
|
+
(0, mocha_1.after)(afterTest);
|
|
38
|
+
(0, mocha_1.it)("check if file exists to be true", () => {
|
|
39
|
+
const fileWriter = new file_writer_1.default(memfs_1.fs, "/test_customer/");
|
|
40
|
+
(0, chai_1.expect)(fileWriter.hasFile("config_SpeedKit", "js")).to.equal(true);
|
|
41
|
+
});
|
|
42
|
+
(0, mocha_1.it)("check if file exists to be false", () => {
|
|
43
|
+
const fileWriter = new file_writer_1.default(memfs_1.fs, "/test_customer/");
|
|
44
|
+
(0, chai_1.expect)(fileWriter.hasFile("custom_documentHandler", "js")).to.equal(false);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
(0, mocha_1.describe)("FileWriter removeFile ", () => {
|
|
48
|
+
(0, mocha_1.before)(beforeTest);
|
|
49
|
+
(0, mocha_1.after)(afterTest);
|
|
50
|
+
(0, mocha_1.it)("check if file exists to be true", () => {
|
|
51
|
+
const fileWriter = new file_writer_1.default(memfs_1.fs, "/test_customer/");
|
|
52
|
+
fileWriter.removeFile("config_SpeedKit", "js");
|
|
53
|
+
(0, chai_1.expect)(memfs_1.fs.existsSync("/test_customer/config_SpeedKit.js")).to.equal(false);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const chai_1 = require("chai");
|
|
5
|
+
const mocha_1 = require("mocha");
|
|
6
|
+
const integration_api_model_1 = require("../integration-api-model");
|
|
7
|
+
const integration_api_service_1 = require("../integration-api-service");
|
|
8
|
+
const file_reader_1 = tslib_1.__importDefault(require("../file-reader"));
|
|
9
|
+
const memfs_1 = require("memfs");
|
|
10
|
+
const cli_1 = require("../../cli");
|
|
11
|
+
const file_writer_1 = tslib_1.__importDefault(require("../file-writer"));
|
|
12
|
+
const mandatory_files_validator_1 = tslib_1.__importDefault(require("../validator/mandatory-files-validator"));
|
|
13
|
+
const customer_config_handler_1 = tslib_1.__importDefault(require("../handler/customer-config-handler"));
|
|
14
|
+
const customer_config_validator_1 = tslib_1.__importDefault(require("../validator/customer-config-validator"));
|
|
15
|
+
const install_resource_handler_1 = tslib_1.__importDefault(require("../handler/install-resource-handler"));
|
|
16
|
+
const static_recipe_1 = require("../virtual/static-recipe");
|
|
17
|
+
const afterTest = () => {
|
|
18
|
+
memfs_1.vol.reset();
|
|
19
|
+
};
|
|
20
|
+
function prepareDependencies() {
|
|
21
|
+
const cli = new cli_1.CliServiceFactory().getService();
|
|
22
|
+
const virtualFileHandler = new integration_api_model_1.VirtualFileHandler(cli);
|
|
23
|
+
// @ts-expect-error fs is not compatible
|
|
24
|
+
const fileReader = new file_reader_1.default(memfs_1.fs, "test", "/test_customer", [], []);
|
|
25
|
+
const fileWriter = new file_writer_1.default(memfs_1.fs, "/test_customer/");
|
|
26
|
+
const validator = new mandatory_files_validator_1.default();
|
|
27
|
+
const customerConfigValidator = new customer_config_validator_1.default();
|
|
28
|
+
const customerConfigHandler = new customer_config_handler_1.default(fileReader, cli, customerConfigValidator, "test", "test");
|
|
29
|
+
const installResourceHandler = new install_resource_handler_1.default(fileReader);
|
|
30
|
+
return {
|
|
31
|
+
virtualFileHandler,
|
|
32
|
+
fileReader,
|
|
33
|
+
fileWriter,
|
|
34
|
+
validator,
|
|
35
|
+
customerConfigHandler,
|
|
36
|
+
installResourceHandler,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
(0, mocha_1.describe)("integration service run", () => {
|
|
40
|
+
(0, mocha_1.before)(() => {
|
|
41
|
+
memfs_1.vol.fromNestedJSON({
|
|
42
|
+
"/test_customer": {
|
|
43
|
+
"config_customer.js": `module.exports = {test:{app:"test",domain:"test.dev",origins:["https://test.dev"],scope:"/",swPath: "/wrapper-sw.js"}}`,
|
|
44
|
+
"config_SpeedKit.js": "",
|
|
45
|
+
"config_dynamicBlocks.js": "",
|
|
46
|
+
"config_dynamicStyles.css": "",
|
|
47
|
+
"config_documentHandler.es6": "",
|
|
48
|
+
"custom_sw.js": "custom serviceWorker content",
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
(0, mocha_1.after)(afterTest);
|
|
53
|
+
(0, mocha_1.it)("no handler found for file", (done) => {
|
|
54
|
+
const { virtualFileHandler, fileReader, fileWriter, validator } = prepareDependencies();
|
|
55
|
+
const integrationApiService = new integration_api_service_1.IntegrationApiService(fileReader, virtualFileHandler, validator, [], fileWriter, true);
|
|
56
|
+
integrationApiService
|
|
57
|
+
.run()
|
|
58
|
+
.then((fileList) => {
|
|
59
|
+
// Assert that our function returned the correct value
|
|
60
|
+
(0, chai_1.expect)(fileList.files.length).to.equal(0);
|
|
61
|
+
done();
|
|
62
|
+
})
|
|
63
|
+
.catch((error) => {
|
|
64
|
+
(0, chai_1.expect)(error.message).to.include("No handler found");
|
|
65
|
+
done();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
(0, mocha_1.it)("find 6 files", (done) => {
|
|
69
|
+
const { virtualFileHandler, fileReader, fileWriter, validator, customerConfigHandler, installResourceHandler, } = prepareDependencies();
|
|
70
|
+
const integrationApiService = new integration_api_service_1.IntegrationApiService(fileReader, virtualFileHandler, validator, [customerConfigHandler, installResourceHandler], fileWriter, true);
|
|
71
|
+
integrationApiService
|
|
72
|
+
.run()
|
|
73
|
+
.then((fileList) => {
|
|
74
|
+
// Assert that our function returned the correct value
|
|
75
|
+
(0, chai_1.expect)(fileList.files.length).to.equal(6);
|
|
76
|
+
done();
|
|
77
|
+
})
|
|
78
|
+
.catch((error) => {
|
|
79
|
+
done(error);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
(0, mocha_1.it)("find virtual file", (done) => {
|
|
83
|
+
const { virtualFileHandler, fileReader, fileWriter, validator, customerConfigHandler, installResourceHandler, } = prepareDependencies();
|
|
84
|
+
const integrationApiService = new integration_api_service_1.IntegrationApiService(fileReader, virtualFileHandler, validator, [customerConfigHandler, installResourceHandler], fileWriter, true);
|
|
85
|
+
integrationApiService
|
|
86
|
+
.run([
|
|
87
|
+
{
|
|
88
|
+
name: "my_virtual_file",
|
|
89
|
+
recipe: new static_recipe_1.StaticRecipe("my_virtual_file_content"),
|
|
90
|
+
},
|
|
91
|
+
])
|
|
92
|
+
.then((fileList) => {
|
|
93
|
+
// Assert that our function returned the correct value
|
|
94
|
+
(0, chai_1.expect)(fileList.getByName("my_virtual_file").getContent()).to.equal("my_virtual_file_content");
|
|
95
|
+
done();
|
|
96
|
+
})
|
|
97
|
+
.catch((error) => {
|
|
98
|
+
done(error);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
(0, mocha_1.it)("override local file with virtual file", (done) => {
|
|
102
|
+
const { virtualFileHandler, fileReader, fileWriter, validator, customerConfigHandler, installResourceHandler, } = prepareDependencies();
|
|
103
|
+
const integrationApiService = new integration_api_service_1.IntegrationApiService(fileReader, virtualFileHandler, validator, [customerConfigHandler, installResourceHandler], fileWriter, true);
|
|
104
|
+
integrationApiService
|
|
105
|
+
.run([
|
|
106
|
+
{
|
|
107
|
+
name: "custom_sw",
|
|
108
|
+
recipe: new static_recipe_1.StaticRecipe("my_virtual_file_content"),
|
|
109
|
+
overrideLocalFile: true,
|
|
110
|
+
},
|
|
111
|
+
])
|
|
112
|
+
.then((fileList) => {
|
|
113
|
+
// Assert that our function returned the correct value
|
|
114
|
+
(0, chai_1.expect)(fileList.getByName("custom_sw").getContent()).to.equal("my_virtual_file_content");
|
|
115
|
+
(0, chai_1.expect)(fileList.files.length).to.equal(6);
|
|
116
|
+
done();
|
|
117
|
+
})
|
|
118
|
+
.catch((error) => {
|
|
119
|
+
done(error);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|