From 365df494aab63576ace732518d6ce648ad7ab137 Mon Sep 17 00:00:00 2001 From: Merlin Beutlberger Date: Mon, 23 Mar 2020 20:31:28 +0100 Subject: [PATCH] [INTERNAL] projectPreprocessor tests: Adopt to required namespaces Tests are failing due to https://github.com/SAP/ui5-builder/pull/430 Adopt tests to provide necessary manifest.json files and expect the corresponding namespace information. --- .../application.a/webapp/manifest.json | 13 ++++++++++ .../application.cycle.a/webapp/manifest.json | 13 ++++++++++ .../library.cycle.a/src/cycle/a/.library | 2 +- .../library.cycle.b/src/cycle/b/.library | 2 +- test/lib/extensions.js | 3 +++ test/lib/projectPreprocessor.js | 24 ++++++++++++++----- 6 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 test/fixtures/application.a/webapp/manifest.json create mode 100644 test/fixtures/cyclic-deps/node_modules/application.cycle.a/webapp/manifest.json diff --git a/test/fixtures/application.a/webapp/manifest.json b/test/fixtures/application.a/webapp/manifest.json new file mode 100644 index 000000000..781945df9 --- /dev/null +++ b/test/fixtures/application.a/webapp/manifest.json @@ -0,0 +1,13 @@ +{ + "_version": "1.1.0", + "sap.app": { + "_version": "1.1.0", + "id": "id1", + "type": "application", + "applicationVersion": { + "version": "1.2.2" + }, + "embeds": ["embedded"], + "title": "{{title}}" + } +} \ No newline at end of file diff --git a/test/fixtures/cyclic-deps/node_modules/application.cycle.a/webapp/manifest.json b/test/fixtures/cyclic-deps/node_modules/application.cycle.a/webapp/manifest.json new file mode 100644 index 000000000..781945df9 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/application.cycle.a/webapp/manifest.json @@ -0,0 +1,13 @@ +{ + "_version": "1.1.0", + "sap.app": { + "_version": "1.1.0", + "id": "id1", + "type": "application", + "applicationVersion": { + "version": "1.2.2" + }, + "embeds": ["embedded"], + "title": "{{title}}" + } +} \ No newline at end of file diff --git a/test/fixtures/cyclic-deps/node_modules/library.cycle.a/src/cycle/a/.library b/test/fixtures/cyclic-deps/node_modules/library.cycle.a/src/cycle/a/.library index 5fd459a0d..f9cfdf731 100644 --- a/test/fixtures/cyclic-deps/node_modules/library.cycle.a/src/cycle/a/.library +++ b/test/fixtures/cyclic-deps/node_modules/library.cycle.a/src/cycle/a/.library @@ -1,7 +1,7 @@ - library.cycle.a + cycle.a SAP SE ${copyright} ${version} diff --git a/test/fixtures/cyclic-deps/node_modules/library.cycle.b/src/cycle/b/.library b/test/fixtures/cyclic-deps/node_modules/library.cycle.b/src/cycle/b/.library index bc47d278e..d7b129ae8 100644 --- a/test/fixtures/cyclic-deps/node_modules/library.cycle.b/src/cycle/b/.library +++ b/test/fixtures/cyclic-deps/node_modules/library.cycle.b/src/cycle/b/.library @@ -1,7 +1,7 @@ - library.cycle.b + cycle.b SAP SE ${copyright} ${version} diff --git a/test/lib/extensions.js b/test/lib/extensions.js index a490e7e1f..c518efe9e 100644 --- a/test/lib/extensions.js +++ b/test/lib/extensions.js @@ -62,6 +62,7 @@ test("Project with project-shim extension with dependency configuration", (t) => type: "application", metadata: { name: "xy", + namespace: "id1" }, resources: { configuration: { @@ -175,6 +176,7 @@ test("Project with project-shim extension with dependency declaration and config type: "application", metadata: { name: "xy", + namespace: "id1" }, resources: { configuration: { @@ -348,6 +350,7 @@ test("Project with project-shim extension with collection", (t) => { type: "application", metadata: { name: "xy", + namespace: "id1" }, resources: { configuration: { diff --git a/test/lib/projectPreprocessor.js b/test/lib/projectPreprocessor.js index 8d764c2af..be02538a6 100644 --- a/test/lib/projectPreprocessor.js +++ b/test/lib/projectPreprocessor.js @@ -36,6 +36,7 @@ test("Project with inline configuration", (t) => { type: "application", metadata: { name: "xy", + namespace: "id1" }, resources: { configuration: { @@ -71,7 +72,8 @@ test("Project with configPath", (t) => { _level: 0, type: "application", metadata: { - name: "application.b" + name: "application.b", + namespace: "id1" }, resources: { configuration: { @@ -107,7 +109,8 @@ test("Project with ui5.yaml at default location", (t) => { _level: 0, type: "application", metadata: { - name: "application.a" + name: "application.a", + namespace: "id1" }, resources: { configuration: { @@ -194,7 +197,8 @@ test("No type configured for root project", (t) => { path: path.join(__dirname, "../fixtures/application.a"), dependencies: [], metadata: { - name: "application.a" + name: "application.a", + namespace: "id1" } }; return t.throwsAsync(projectPreprocessor.processTree(tree), @@ -328,7 +332,8 @@ test("Ignores additional application-projects", (t) => { _level: 0, type: "application", metadata: { - name: "application.a" + name: "application.a", + namespace: "id1" }, resources: { configuration: { @@ -418,7 +423,8 @@ test("Inconsistent dependencies with same ID", (t) => { _level: 0, type: "application", metadata: { - name: "application.a" + name: "application.a", + namespace: "id1" }, resources: { configuration: { @@ -689,7 +695,8 @@ const expectedTreeWithInvalidModules = { "specVersion": "1.0", "type": "application", "metadata": { - "name": "application.a" + "name": "application.a", + "namespace": "id1" }, "_level": 0, "kind": "project", @@ -831,6 +838,7 @@ const expectedTreeAWithInlineConfigs = { "type": "application", "metadata": { "name": "application.a", + "namespace": "id1" }, "resources": { "configuration": { @@ -945,6 +953,7 @@ const expectedTreeAWithConfigPaths = { "type": "application", "metadata": { "name": "application.a", + "namespace": "id1" }, "resources": { "configuration": { @@ -1402,6 +1411,7 @@ const expectedTreeApplicationCycleA = { "type": "application", "metadata": { "name": "application.cycle.a", + "namespace": "id1" }, "dependencies": [ { @@ -1424,6 +1434,7 @@ const expectedTreeApplicationCycleA = { "type": "library", "metadata": { "name": "library.cycle.a", + "namespace": "cycle/a", "copyright": "${copyright}" }, "dependencies": [ @@ -1464,6 +1475,7 @@ const expectedTreeApplicationCycleA = { "type": "library", "metadata": { "name": "library.cycle.b", + "namespace": "cycle/b", "copyright": "${copyright}" }, "dependencies": [