From d86351056d9c1e4a95e82d7ae15c3752d4c7e4d9 Mon Sep 17 00:00:00 2001 From: Oliver Klemenz Date: Wed, 8 May 2024 08:12:19 +0200 Subject: [PATCH] Linting --- .eslintignore | 2 - .eslintrc.yml | 3 + .prettierignore | 2 - .../_env/app/parameters/webapp/Component.js | 2 +- test-integration/_env/srv/server.js | 4 +- .../integration-agreement.test.js | 16 +- test-integration/integration-main.test.js | 52 +- test/_env/app/analytics/webapp/Component.js | 2 +- test/_env/app/basic/webapp/Component.js | 2 +- test/_env/app/draft/webapp/Component.js | 2 +- test/_env/app/hierarchy/webapp/Component.js | 2 +- test/_env/app/overview/webapp/Component.js | 2 +- test/_env/app/xml/webapp/Component.js | 2 +- test/_env/srv/handlers/main.js | 2 + test/_env/srv/init/index.js | 10 +- test/analytics.test.js | 162 ++-- test/attachment.test.js | 14 +- test/audit.test.js | 8 +- test/auth.test.js | 45 +- test/batch.test.js | 8 +- test/cache.test.js | 38 +- test/draft.test.js | 481 +++++----- test/emissions.test.js | 4 +- test/main-xml.test.js | 47 +- test/main.test.js | 890 +++++++++--------- test/mtx/mtx-local.test.js | 16 +- test/mtx/mtx-remote.test.js | 2 +- test/mtx/mtxs.test.js | 10 +- test/passenger.test.js | 4 +- test/protocols.test.js | 35 +- test/task-provider.test.js | 13 +- test/todo.test.js | 300 +++--- 32 files changed, 1163 insertions(+), 1019 deletions(-) diff --git a/.eslintignore b/.eslintignore index 734ce7e9..02d4b8b1 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,2 @@ node_modules/ reports/ -test/ -test-integration/ diff --git a/.eslintrc.yml b/.eslintrc.yml index f0dabbd1..37a70488 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -26,10 +26,13 @@ rules: no-unused-vars: [off] require-atomic-updates: [off] jest/no-conditional-expect: [off] + jest/no-disabled-tests: [off] + jest/expect-expect: [off] no-restricted-modules: [error, child_process] # security no-eval: [error] # security no-implied-eval: [error] # security no-console: [error] # ops + no-useless-escape: [off] strict: [off] curly: [error] no-constant-condition: [error, { checkLoops: false }] diff --git a/.prettierignore b/.prettierignore index 734ce7e9..02d4b8b1 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,2 @@ node_modules/ reports/ -test/ -test-integration/ diff --git a/test-integration/_env/app/parameters/webapp/Component.js b/test-integration/_env/app/parameters/webapp/Component.js index 32190f11..e02f65c8 100644 --- a/test-integration/_env/app/parameters/webapp/Component.js +++ b/test-integration/_env/app/parameters/webapp/Component.js @@ -3,5 +3,5 @@ sap.ui.define(["sap/ui/generic/app/AppComponent"], (AppComponent) => metadata: { manifest: "json", }, - }) + }), ); diff --git a/test-integration/_env/srv/server.js b/test-integration/_env/srv/server.js index 8eff8206..5762e527 100644 --- a/test-integration/_env/srv/server.js +++ b/test-integration/_env/srv/server.js @@ -6,7 +6,9 @@ const cov2ap = require("../../../src"); let credentials = JSON.parse(process.env.HANA_DB_CREDENTIALS || null); try { credentials = require("../db/default-services").hana[0].credentials; -} catch {} +} catch { + // ignore +} cds.env.requires.db = { kind: "hana", diff --git a/test-integration/integration-agreement.test.js b/test-integration/integration-agreement.test.js index 4cba82e8..62bd7004 100644 --- a/test-integration/integration-agreement.test.js +++ b/test-integration/integration-agreement.test.js @@ -32,7 +32,7 @@ describe("integration-agreement", () => { // Empty Parameters let response = await util.callRead( request, - "/odata/v2/agreement/AgreementItemPricingForKeyDate(datetime'2002-06-20T00:00:00')" + "/odata/v2/agreement/AgreementItemPricingForKeyDate(datetime'2002-06-20T00:00:00')", ); expect(response.statusCode).toEqual(404); expect(response.body).toBeDefined(); @@ -62,14 +62,14 @@ describe("integration-agreement", () => { // Empty Set response = await util.callRead( request, - "/odata/v2/agreement/AgreementItemPricingForKeyDate(keyDate=datetime'2000-06-20T00:00:00')/Set" + "/odata/v2/agreement/AgreementItemPricingForKeyDate(keyDate=datetime'2000-06-20T00:00:00')/Set", ); expect(response.body.d.results).toEqual([]); // Parameters response = await util.callRead( request, - "/odata/v2/agreement/AgreementItemPricingForKeyDate(datetime'2022-06-20T00:00:00')" + "/odata/v2/agreement/AgreementItemPricingForKeyDate(datetime'2022-06-20T00:00:00')", ); expect(response.body).toBeDefined(); expect(clean(response.body)).toMatchSnapshot(); @@ -77,7 +77,7 @@ describe("integration-agreement", () => { // Result Set response = await util.callRead( request, - "/odata/v2/agreement/AgreementItemPricingForKeyDate(keyDate=datetime'2022-06-20T00:00:00')/Set" + "/odata/v2/agreement/AgreementItemPricingForKeyDate(keyDate=datetime'2022-06-20T00:00:00')/Set", ); expect(response.body).toBeDefined(); expect(clean(response.body)).toMatchSnapshot(); @@ -85,7 +85,7 @@ describe("integration-agreement", () => { // Single Entry response = await util.callRead( request, - "/odata/v2/agreement/AgreementItemPricingForKeyDateSet(keyDate=datetime'2022-06-20T00:00:00',ID=guid'f8420eac-a36b-49af-b91c-6559b8f7627e')" + "/odata/v2/agreement/AgreementItemPricingForKeyDateSet(keyDate=datetime'2022-06-20T00:00:00',ID=guid'f8420eac-a36b-49af-b91c-6559b8f7627e')", ); expect(response.body).toBeDefined(); expect(clean(response.body)).toMatchSnapshot(); @@ -93,7 +93,7 @@ describe("integration-agreement", () => { // Entry Parameters response = await util.callRead( request, - "/odata/v2/agreement/AgreementItemPricingForKeyDateSet(keyDate=datetime'2022-06-20T00:00:00',ID=guid'f8420eac-a36b-49af-b91c-6559b8f7627e')/Parameters" + "/odata/v2/agreement/AgreementItemPricingForKeyDateSet(keyDate=datetime'2022-06-20T00:00:00',ID=guid'f8420eac-a36b-49af-b91c-6559b8f7627e')/Parameters", ); expect(response.body).toBeDefined(); expect(clean(response.body)).toMatchSnapshot(); @@ -102,7 +102,7 @@ describe("integration-agreement", () => { it("GET with parameters and $count", async () => { const response = await util.callRead( request, - "/odata/v2/agreement/AgreementItemPricingForKeyDate(keyDate=datetime'2022-06-20T00:00:00')/Set/$count" + "/odata/v2/agreement/AgreementItemPricingForKeyDate(keyDate=datetime'2022-06-20T00:00:00')/Set/$count", ); expect(response.text).toEqual("2"); }); @@ -110,7 +110,7 @@ describe("integration-agreement", () => { it("GET with parameters and sort", async () => { const response = await util.callRead( request, - "/odata/v2/agreement/AgreementItemPricingForKeyDate(keyDate=datetime'2022-06-20T00:00:00')/Set?$skip=0&$top=20&$orderby=keyDate%20asc" + "/odata/v2/agreement/AgreementItemPricingForKeyDate(keyDate=datetime'2022-06-20T00:00:00')/Set?$skip=0&$top=20&$orderby=keyDate%20asc", ); expect(response.body.d.results.length).toEqual(2); }); diff --git a/test-integration/integration-main.test.js b/test-integration/integration-main.test.js index 9ea15f64..2049010a 100644 --- a/test-integration/integration-main.test.js +++ b/test-integration/integration-main.test.js @@ -119,7 +119,7 @@ describe("integration-main", () => { // Single Entry response = await util.callRead( request, - `/odata/v2/main/HeaderParametersSet(STOCK=${stock},CURRENCY='EUR',ID=guid'${ID}')` + `/odata/v2/main/HeaderParametersSet(STOCK=${stock},CURRENCY='EUR',ID=guid'${ID}')`, ); expect(response.body).toBeDefined(); expect(clean(response.body, ID)).toMatchSnapshot(); @@ -127,7 +127,7 @@ describe("integration-main", () => { // Entry Parameters response = await util.callRead( request, - `/odata/v2/main/HeaderParametersSet(STOCK=${stock},CURRENCY='EUR',ID=guid'${ID}')/Parameters` + `/odata/v2/main/HeaderParametersSet(STOCK=${stock},CURRENCY='EUR',ID=guid'${ID}')/Parameters`, ); expect(response.body).toBeDefined(); expect(clean(response.body, ID)).toMatchSnapshot(); @@ -181,14 +181,17 @@ describe("integration-main", () => { expect(clean(response.body, ID)).toMatchSnapshot(); // Single Entry - response = await util.callRead(request, `/odata/v2/main/HeaderSetSet(STOCK=${stock},CURRENCY='EUR',ID=guid'${ID}')`); + response = await util.callRead( + request, + `/odata/v2/main/HeaderSetSet(STOCK=${stock},CURRENCY='EUR',ID=guid'${ID}')`, + ); expect(response.body).toBeDefined(); expect(clean(response.body, ID)).toMatchSnapshot(); // Entry Parameters response = await util.callRead( request, - `/odata/v2/main/HeaderSetSet(STOCK=${stock},CURRENCY='EUR',ID=guid'${ID}')/Parameters` + `/odata/v2/main/HeaderSetSet(STOCK=${stock},CURRENCY='EUR',ID=guid'${ID}')/Parameters`, ); expect(response.body).toBeDefined(); expect(clean(response.body, ID)).toMatchSnapshot(); @@ -242,14 +245,17 @@ describe("integration-main", () => { expect(clean(response.body, ID)).toMatchSnapshot(); // Single Entry - response = await util.callRead(request, `/odata/v2/main/HeaderUnionSetSet(STOCK=${stock},CURRENCY='EUR',ID=guid'${ID}')`); + response = await util.callRead( + request, + `/odata/v2/main/HeaderUnionSetSet(STOCK=${stock},CURRENCY='EUR',ID=guid'${ID}')`, + ); expect(response.body).toBeDefined(); expect(clean(response.body, ID)).toMatchSnapshot(); // Entry Parameters response = await util.callRead( request, - `/odata/v2/main/HeaderUnionSetSet(STOCK=${stock},CURRENCY='EUR',ID=guid'${ID}')/Parameters` + `/odata/v2/main/HeaderUnionSetSet(STOCK=${stock},CURRENCY='EUR',ID=guid'${ID}')/Parameters`, ); expect(response.body).toBeDefined(); expect(clean(response.body, ID)).toMatchSnapshot(); @@ -261,11 +267,20 @@ describe("integration-main", () => { }); expect(response.statusCode).toEqual(201); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof('es',name)`); + response = await util.callRead( + request, + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof('es',name)`, + ); expect(response.body.d.results).toHaveLength(1); - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof('ES',name)`); + response = await util.callRead( + request, + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof('ES',name)`, + ); expect(response.body.d.results).toHaveLength(1); - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof('XX',name)`); + response = await util.callRead( + request, + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof('XX',name)`, + ); expect(response.body.d.results).toHaveLength(0); await util.callDelete(request, `/odata/v2/main/Header(guid'${id}')`); }); @@ -276,11 +291,20 @@ describe("integration-main", () => { }); expect(response.statusCode).toEqual(201); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${id}' and startswith(name,'Te')`); + response = await util.callRead( + request, + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and startswith(name,'Te')`, + ); expect(response.body.d.results).toHaveLength(1); - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${id}' and startswith(name,'TE')`); + response = await util.callRead( + request, + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and startswith(name,'TE')`, + ); expect(response.body.d.results).toHaveLength(1); - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${id}' and startswith(name,'XX')`); + response = await util.callRead( + request, + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and startswith(name,'XX')`, + ); expect(response.body.d.results).toHaveLength(0); await util.callDelete(request, `/odata/v2/main/Header(guid'${id}')`); }); @@ -321,9 +345,7 @@ describe("integration-main", () => { function clean(responseBody, ID) { function replaceUri(text) { - return text - .replace(/localhost:([0-9]*)/g, "localhost:00000") - .replace(ID, "") + return text.replace(/localhost:([0-9]*)/g, "localhost:00000").replace(ID, ""); } function replaceAll(entry) { diff --git a/test/_env/app/analytics/webapp/Component.js b/test/_env/app/analytics/webapp/Component.js index 3b96538b..47b2033f 100644 --- a/test/_env/app/analytics/webapp/Component.js +++ b/test/_env/app/analytics/webapp/Component.js @@ -3,5 +3,5 @@ sap.ui.define(["sap/ui/generic/app/AppComponent"], (AppComponent) => metadata: { manifest: "json", }, - }) + }), ); diff --git a/test/_env/app/basic/webapp/Component.js b/test/_env/app/basic/webapp/Component.js index 44a41a16..749277c7 100644 --- a/test/_env/app/basic/webapp/Component.js +++ b/test/_env/app/basic/webapp/Component.js @@ -3,5 +3,5 @@ sap.ui.define(["sap/ui/generic/app/AppComponent"], (AppComponent) => metadata: { manifest: "json", }, - }) + }), ); diff --git a/test/_env/app/draft/webapp/Component.js b/test/_env/app/draft/webapp/Component.js index 85157119..a35ac6d6 100644 --- a/test/_env/app/draft/webapp/Component.js +++ b/test/_env/app/draft/webapp/Component.js @@ -3,5 +3,5 @@ sap.ui.define(["sap/ui/generic/app/AppComponent"], (AppComponent) => metadata: { manifest: "json", }, - }) + }), ); diff --git a/test/_env/app/hierarchy/webapp/Component.js b/test/_env/app/hierarchy/webapp/Component.js index 0b794d4a..05e7d400 100644 --- a/test/_env/app/hierarchy/webapp/Component.js +++ b/test/_env/app/hierarchy/webapp/Component.js @@ -3,5 +3,5 @@ sap.ui.define(["sap/ui/generic/app/AppComponent"], (AppComponent) => metadata: { manifest: "json", }, - }) + }), ); diff --git a/test/_env/app/overview/webapp/Component.js b/test/_env/app/overview/webapp/Component.js index c90a5cde..450cd08b 100644 --- a/test/_env/app/overview/webapp/Component.js +++ b/test/_env/app/overview/webapp/Component.js @@ -3,5 +3,5 @@ sap.ui.define(["sap/ovp/app/Component"], (AppComponent) => metadata: { manifest: "json", }, - }) + }), ); diff --git a/test/_env/app/xml/webapp/Component.js b/test/_env/app/xml/webapp/Component.js index c7eec8f7..efcb77a5 100644 --- a/test/_env/app/xml/webapp/Component.js +++ b/test/_env/app/xml/webapp/Component.js @@ -3,5 +3,5 @@ sap.ui.define(["sap/ui/generic/app/AppComponent"], (AppComponent) => metadata: { manifest: "json", }, - }) + }), ); diff --git a/test/_env/srv/handlers/main.js b/test/_env/srv/handlers/main.js index ad682097..a9ae5953 100644 --- a/test/_env/srv/handlers/main.js +++ b/test/_env/srv/handlers/main.js @@ -1,5 +1,7 @@ "use strict"; +const cds = require("@sap/cds"); + module.exports = (srv) => { const { Header, HeaderStream, Book, User } = srv.entities("test.MainService"); diff --git a/test/_env/srv/init/index.js b/test/_env/srv/init/index.js index b005c5ec..283ede05 100644 --- a/test/_env/srv/init/index.js +++ b/test/_env/srv/init/index.js @@ -21,11 +21,11 @@ async function initData({ app }) { }); responses.push(response); } - console.log( + cds.log().info( "Test Instances: " + responses.filter((entry) => { return entry.statusCode === 201; - }).length + }).length, ); } @@ -38,7 +38,7 @@ async function initBinary({ port }) { data: file, mediaType: "image/png", filename: "file.png", - }) + }), ); await cds.run( INSERT.into("test.HeaderStreamAttachment").entries({ @@ -46,7 +46,7 @@ async function initBinary({ port }) { data: file, mediaType: "image/png", filename: "file.png", - }) + }), ); await cds.run( INSERT.into("test.HeaderUrlStream").entries([ @@ -68,6 +68,6 @@ async function initBinary({ port }) { mediaType: "image/png", filename: "file.png", }, - ]) + ]), ); } diff --git a/test/analytics.test.js b/test/analytics.test.js index b0009652..08add64b 100644 --- a/test/analytics.test.js +++ b/test/analytics.test.js @@ -42,7 +42,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'ABC'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -54,7 +54,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'CHF'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -66,7 +66,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'EUR'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -78,7 +78,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'U%2FSD'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -90,7 +90,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'USD'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -103,7 +103,7 @@ describe("analytics", () => { }); response = await util.callRead( request, - `/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'USD'"},"value":["currency","stock"]}')` + `/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'USD'"},"value":["currency","stock"]}')`, ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -111,7 +111,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'USD'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -122,7 +122,7 @@ describe("analytics", () => { }); response = await util.callRead( request, - `/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'U%2FSD'"},"value":["currency","stock"]}')` + `/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'U%2FSD'"},"value":["currency","stock"]}')`, ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -130,7 +130,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'U%2FSD'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -151,7 +151,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"country":"'Germany'","currency":"'EUR'"},"value":["country","currency","stock","price"]}')`, type: "test.AnalyticsService.Header", }, @@ -165,7 +165,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"country":"'New%20%22Jersey'","currency":"'ABC'"},"value":["country","currency","stock","price"]}')`, type: "test.AnalyticsService.Header", }, @@ -179,7 +179,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"country":"'New%20York'","currency":"'U%2FSD'"},"value":["country","currency","stock","price"]}')`, type: "test.AnalyticsService.Header", }, @@ -193,7 +193,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"country":"'Spain'","currency":"'EUR'"},"value":["country","currency","stock","price"]}')`, type: "test.AnalyticsService.Header", }, @@ -207,7 +207,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"country":"'Switzerland'","currency":"'CHF'"},"value":["country","currency","stock","price"]}')`, type: "test.AnalyticsService.Header", }, @@ -221,7 +221,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"country":"'Texas'","currency":"'USD'"},"value":["country","currency","stock","price"]}')`, type: "test.AnalyticsService.Header", }, @@ -239,7 +239,7 @@ describe("analytics", () => { it("GET request with grouping and aggregation and order by", async () => { const response = await util.callRead( request, - "/odata/v2/analytics/Header?$select=currency,stock&$top=5&$orderby=stock asc" + "/odata/v2/analytics/Header?$select=currency,stock&$top=5&$orderby=stock asc", ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -249,7 +249,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'ABC'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -261,7 +261,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'CHF'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -273,7 +273,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'USD'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -285,7 +285,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'EUR'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -297,7 +297,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'U%2FSD'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -313,7 +313,7 @@ describe("analytics", () => { it("GET request with grouping and aggregation and filter", async () => { let response = await util.callRead( request, - "/odata/v2/analytics/Header?$select=stock,currency&$top=4&$filter=currency eq 'USD'" + "/odata/v2/analytics/Header?$select=stock,currency&$top=4&$filter=currency eq 'USD'", ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -323,7 +323,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'USD'"},"value":["stock","currency"],"filter":"currency%20eq%20'USD'"}')`, type: "test.AnalyticsService.Header", }, @@ -336,7 +336,7 @@ describe("analytics", () => { }); response = await util.callRead( request, - '/odata/v2/analytics/Header(aggregation\'{"key":{"currency":"\'USD\'"},"value":["stock","currency"],"filter":"currency%20eq%20\'USD\'"}\')' + '/odata/v2/analytics/Header(aggregation\'{"key":{"currency":"\'USD\'"},"value":["stock","currency"],"filter":"currency%20eq%20\'USD\'"}\')', ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -344,7 +344,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'USD'"},"value":["stock","currency"],"filter":"currency%20eq%20'USD'"}')`, type: "test.AnalyticsService.Header", }, @@ -356,7 +356,7 @@ describe("analytics", () => { response = await util.callRead( request, - "/odata/v2/analytics/Header?$select=stock,currency&$top=4&$filter=(currency eq 'USD' or currency eq 'EUR')" + "/odata/v2/analytics/Header?$select=stock,currency&$top=4&$filter=(currency eq 'USD' or currency eq 'EUR')", ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -366,7 +366,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'EUR'"},"value":["stock","currency"],"filter":"(currency%20eq%20'USD'%20or%20currency%20eq%20'EUR')"}')`, type: "test.AnalyticsService.Header", }, @@ -378,7 +378,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'USD'"},"value":["stock","currency"],"filter":"(currency%20eq%20'USD'%20or%20currency%20eq%20'EUR')"}')`, type: "test.AnalyticsService.Header", }, @@ -391,7 +391,7 @@ describe("analytics", () => { }); response = await util.callRead( request, - '/odata/v2/analytics/Header(aggregation\'{"key":{"currency":"\'EUR\'"},"value":["stock","currency"],"filter":"(currency%20eq%20\'USD\'%20or%20currency%20eq%20\'EUR\')"}\')' + '/odata/v2/analytics/Header(aggregation\'{"key":{"currency":"\'EUR\'"},"value":["stock","currency"],"filter":"(currency%20eq%20\'USD\'%20or%20currency%20eq%20\'EUR\')"}\')', ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -399,7 +399,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'EUR'"},"value":["stock","currency"],"filter":"(currency%20eq%20'USD'%20or%20currency%20eq%20'EUR')"}')`, type: "test.AnalyticsService.Header", }, @@ -410,7 +410,7 @@ describe("analytics", () => { }); response = await util.callRead( request, - '/odata/v2/analytics/Header(aggregation\'{"key":{"currency":"\'USD\'"},"value":["stock","currency"],"filter":"(currency%20eq%20\'USD\'%20or%20currency%20eq%20\'EUR\')"}\')' + '/odata/v2/analytics/Header(aggregation\'{"key":{"currency":"\'USD\'"},"value":["stock","currency"],"filter":"(currency%20eq%20\'USD\'%20or%20currency%20eq%20\'EUR\')"}\')', ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -418,7 +418,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'USD'"},"value":["stock","currency"],"filter":"(currency%20eq%20'USD'%20or%20currency%20eq%20'EUR')"}')`, type: "test.AnalyticsService.Header", }, @@ -430,7 +430,10 @@ describe("analytics", () => { }); it("GET request with aggregation and filter element not selected", async () => { - let response = await util.callRead(request, "/odata/v2/analytics/Header?$select=stock&$top=4&$filter=currency eq 'USD'"); + let response = await util.callRead( + request, + "/odata/v2/analytics/Header?$select=stock&$top=4&$filter=currency eq 'USD'", + ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ d: { @@ -439,7 +442,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{},"value":["stock"],"filter":"currency%20eq%20'USD'"}')`, type: "test.AnalyticsService.Header", }, @@ -451,7 +454,7 @@ describe("analytics", () => { }); response = await util.callRead( request, - '/odata/v2/analytics/Header(aggregation\'{"key":{},"value":["stock"],"filter":"currency%20eq%20\'USD\'"}\')' + '/odata/v2/analytics/Header(aggregation\'{"key":{},"value":["stock"],"filter":"currency%20eq%20\'USD\'"}\')', ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -459,7 +462,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{},"value":["stock"],"filter":"currency%20eq%20'USD'"}')`, type: "test.AnalyticsService.Header", }, @@ -470,7 +473,7 @@ describe("analytics", () => { response = await util.callRead( request, - "/odata/v2/analytics/Header?$select=stock&$top=4&$filter=(currency eq 'USD' or currency eq 'EUR')" + "/odata/v2/analytics/Header?$select=stock&$top=4&$filter=(currency eq 'USD' or currency eq 'EUR')", ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -480,7 +483,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{},"value":["stock"],"filter":"(currency%20eq%20'USD'%20or%20currency%20eq%20'EUR')"}')`, type: "test.AnalyticsService.Header", }, @@ -492,7 +495,7 @@ describe("analytics", () => { }); response = await util.callRead( request, - '/odata/v2/analytics/Header(aggregation\'{"key":{},"value":["stock"],"filter":"(currency%20eq%20\'USD\'%20or%20currency%20eq%20\'EUR\')"}\')' + '/odata/v2/analytics/Header(aggregation\'{"key":{},"value":["stock"],"filter":"(currency%20eq%20\'USD\'%20or%20currency%20eq%20\'EUR\')"}\')', ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -500,7 +503,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{},"value":["stock"],"filter":"(currency%20eq%20'USD'%20or%20currency%20eq%20'EUR')"}')`, type: "test.AnalyticsService.Header", }, @@ -522,7 +525,9 @@ describe("analytics", () => { code: "501", message: { lang: "en", - value: expect.stringMatching(/Feature is not supported: Transformation "(10|SEARCH)" with query option \$apply/), + value: expect.stringMatching( + /Feature is not supported: Transformation "(10|SEARCH)" with query option \$apply/, + ), }, severity: "error", target: "/#TRANSIENT#", @@ -531,7 +536,9 @@ describe("analytics", () => { }, message: { lang: "en", - value: expect.stringMatching(/Feature is not supported: Transformation "(10|SEARCH)" with query option \$apply/), + value: expect.stringMatching( + /Feature is not supported: Transformation "(10|SEARCH)" with query option \$apply/, + ), }, severity: "error", target: "/#TRANSIENT#", @@ -542,7 +549,7 @@ describe("analytics", () => { it("GET request with grouping and aggregation combined with search and filtering", async () => { let response = await util.callRead( request, - "/odata/v2/analytics/Header?$select=stock&$filter=currency eq 'USD'&search=Header" + "/odata/v2/analytics/Header?$select=stock&$filter=currency eq 'USD'&search=Header", ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -554,7 +561,9 @@ describe("analytics", () => { code: "501", message: { lang: "en", - value: expect.stringMatching(/Feature is not supported: Transformation "(10|SEARCH)" with query option \$apply/), + value: expect.stringMatching( + /Feature is not supported: Transformation "(10|SEARCH)" with query option \$apply/, + ), }, severity: "error", target: "/#TRANSIENT#", @@ -563,7 +572,9 @@ describe("analytics", () => { }, message: { lang: "en", - value: expect.stringMatching(/Feature is not supported: Transformation "(10|SEARCH)" with query option \$apply/), + value: expect.stringMatching( + /Feature is not supported: Transformation "(10|SEARCH)" with query option \$apply/, + ), }, severity: "error", target: "/#TRANSIENT#", @@ -581,7 +592,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'ABC'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -593,7 +604,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'CHF'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -605,7 +616,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'EUR'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -617,7 +628,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'U%2FSD'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -629,7 +640,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'USD'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -642,7 +653,7 @@ describe("analytics", () => { }); response = await util.callRead( request, - `/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'USD'"},"value":["currency","stock"]}')` + `/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'USD'"},"value":["currency","stock"]}')`, ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -650,7 +661,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'USD'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -661,7 +672,7 @@ describe("analytics", () => { }); response = await util.callRead( request, - `/odata/v2/analytics/Header('aggregation'{"key":{"currency":"'USD'"},"value":["currency","stock"]}'')` + `/odata/v2/analytics/Header('aggregation'{"key":{"currency":"'USD'"},"value":["currency","stock"]}'')`, ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -669,7 +680,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'USD'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -680,7 +691,7 @@ describe("analytics", () => { }); response = await util.callRead( request, - `/odata/v2/analytics/Header(ID__='aggregation'{"key":{"currency":"'USD'"},"value":["currency","stock"]}'')` + `/odata/v2/analytics/Header(ID__='aggregation'{"key":{"currency":"'USD'"},"value":["currency","stock"]}'')`, ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -688,7 +699,7 @@ describe("analytics", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Header(aggregation'{"key":{"currency":"'USD'"},"value":["currency","stock"]}')`, type: "test.AnalyticsService.Header", }, @@ -710,7 +721,7 @@ describe("analytics", () => { type: "test.AnalyticsService.HeaderItemCount", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/HeaderItemCount(aggregation\'{"key":{"startAt":"datetimeoffset\'%2FDate(1546300800000%2B0000)%2F\'"},"value":["startAt","header"]}\')`, }, header: "4", @@ -722,7 +733,7 @@ describe("analytics", () => { type: "test.AnalyticsService.HeaderItemCount", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/HeaderItemCount(aggregation\'{"key":{"startAt":"datetimeoffset\'%2FDate(1577836800000%2B0000)%2F\'"},"value":["startAt","header"]}\')`, }, header: "4", @@ -734,7 +745,7 @@ describe("analytics", () => { type: "test.AnalyticsService.HeaderItemCount", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/HeaderItemCount(aggregation\'{"key":{"startAt":"datetimeoffset\'%2FDate(1640995200000%2B0000)%2F\'"},"value":["startAt","header"]}\')`, }, header: "1", @@ -756,7 +767,7 @@ describe("analytics", () => { type: "test.AnalyticsService.HeaderItemCount", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/HeaderItemCount(aggregation\'{"key":{"startAt":"datetimeoffset\'%2FDate(1546300800000%2B0000)%2F\'"},"value":["startAt","header2"]}\')`, }, header2: 4, @@ -768,7 +779,7 @@ describe("analytics", () => { type: "test.AnalyticsService.HeaderItemCount", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/HeaderItemCount(aggregation\'{"key":{"startAt":"datetimeoffset\'%2FDate(1577836800000%2B0000)%2F\'"},"value":["startAt","header2"]}\')`, }, header2: 4, @@ -780,7 +791,7 @@ describe("analytics", () => { type: "test.AnalyticsService.HeaderItemCount", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/HeaderItemCount(aggregation\'{"key":{"startAt":"datetimeoffset\'%2FDate(1640995200000%2B0000)%2F\'"},"value":["startAt","header2"]}\')`, }, header2: 1, @@ -802,7 +813,7 @@ describe("analytics", () => { type: "test.AnalyticsService.HeaderItemCount", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/HeaderItemCount(aggregation\'{"key":{"startAt":"datetimeoffset\'%2FDate(1546300800000%2B0000)%2F\'"},"value":["startAt","header_count"]}\')`, }, header_count: "4", @@ -814,7 +825,7 @@ describe("analytics", () => { type: "test.AnalyticsService.HeaderItemCount", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/HeaderItemCount(aggregation\'{"key":{"startAt":"datetimeoffset\'%2FDate(1577836800000%2B0000)%2F\'"},"value":["startAt","header_count"]}\')`, }, header_count: "4", @@ -826,7 +837,7 @@ describe("analytics", () => { type: "test.AnalyticsService.HeaderItemCount", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/HeaderItemCount(aggregation\'{"key":{"startAt":"datetimeoffset\'%2FDate(1640995200000%2B0000)%2F\'"},"value":["startAt","header_count"]}\')`, }, header_count: "2", @@ -840,7 +851,7 @@ describe("analytics", () => { it("POST bound action on analytical entity", async () => { let response = await util.callRead( request, - "/odata/v2/analytics/Book?$select=author,genre_ID,price&$top=124&$inlinecount=allpages" + "/odata/v2/analytics/Book?$select=author,genre_ID,price&$top=124&$inlinecount=allpages", ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); @@ -856,7 +867,7 @@ describe("analytics", () => { type: "test.AnalyticsService.Book", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Book(author='Catweazle',genre_ID=1)`, }, }); @@ -865,7 +876,7 @@ describe("analytics", () => { it("POST bound action on analytical entity with incomplete key", async () => { let response = await util.callRead( request, - "/odata/v2/analytics/Book?$select=author,price&$top=124&$inlinecount=allpages" + "/odata/v2/analytics/Book?$select=author,price&$top=124&$inlinecount=allpages", ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); @@ -900,14 +911,14 @@ describe("analytics", () => { it("POST bound action on analytical entity with whitespaces in key", async () => { let response = await util.callRead( request, - "/odata/v2/analytics/Book?$select=author,genre_ID,price&$top=124&$inlinecount=allpages" + "/odata/v2/analytics/Book?$select=author,genre_ID,price&$top=124&$inlinecount=allpages", ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); const ID__ = response.body.d.results[0].ID__; response = await util.callWrite( request, - `/odata/v2/analytics/Book_order?ID__=${ID__.replace("Catweazle", "Cat weazle")}&number=5` + `/odata/v2/analytics/Book_order?ID__=${ID__.replace("Catweazle", "Cat weazle")}&number=5`, ); expect(response.body.d).toMatchObject({ author: "Cat weazle", @@ -919,7 +930,7 @@ describe("analytics", () => { type: "test.AnalyticsService.Book", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Book(author='Cat%20weazle',genre_ID=1)`, }, }); @@ -928,12 +939,15 @@ describe("analytics", () => { it("POST bound action on analytical entity with escaped ID__", async () => { let response = await util.callRead( request, - "/odata/v2/analytics/Book?$select=author,genre_ID,price&$top=124&$inlinecount=allpages" + "/odata/v2/analytics/Book?$select=author,genre_ID,price&$top=124&$inlinecount=allpages", ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); const ID__ = response.body.d.results[0].ID__; - response = await util.callWrite(request, `/odata/v2/analytics/Book_order?ID__='${ID__.replace(/'/g, "''")}'&number=5`); + response = await util.callWrite( + request, + `/odata/v2/analytics/Book_order?ID__='${ID__.replace(/'/g, "''")}'&number=5`, + ); expect(response.body.d).toMatchObject({ author: "Catweazle", genre_ID: 1, @@ -944,7 +958,7 @@ describe("analytics", () => { type: "test.AnalyticsService.Book", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/analytics/Book(author='Catweazle',genre_ID=1)`, }, }); diff --git a/test/attachment.test.js b/test/attachment.test.js index 8856e1ca..1a2783ab 100644 --- a/test/attachment.test.js +++ b/test/attachment.test.js @@ -33,7 +33,7 @@ describe("attachment", () => { false, { "content-type": "image/png", - } + }, ); expect(response.statusCode).toEqual(201); expect(response.body).toBeDefined(); @@ -47,7 +47,7 @@ describe("attachment", () => { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/attachment/Attachment(guid'${attachmentId}')/folder`, }, }, @@ -55,11 +55,11 @@ describe("attachment", () => { type: "attachment.AttachmentService.Attachment", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/attachment/Attachment(guid'${attachmentId}')`, media_src: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/attachment/Attachment(guid'${attachmentId}')/$value`, content_type: "image/png", }, @@ -75,19 +75,19 @@ describe("attachment", () => { content_type: "image/png", media_src: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/attachment/Attachment(guid'${attachmentId}')/$value`, type: "attachment.AttachmentService.Attachment", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/attachment/Attachment(guid'${attachmentId}')`, }, folder: { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/attachment/Attachment(guid'${attachmentId}')/folder`, }, }, diff --git a/test/audit.test.js b/test/audit.test.js index 646d6801..d9462e7c 100644 --- a/test/audit.test.js +++ b/test/audit.test.js @@ -40,7 +40,7 @@ describe("auth", () => { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/audit/Audits(guid'${id}')/audit_type`, }, }, @@ -48,7 +48,7 @@ describe("auth", () => { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/audit/Audits(guid'${id}')/work_activity`, }, }, @@ -90,7 +90,7 @@ describe("auth", () => { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/audit/Audits(guid'${id}')/audit_type`, }, }, @@ -98,7 +98,7 @@ describe("auth", () => { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/audit/Audits(guid'${id}')/work_activity`, }, }, diff --git a/test/auth.test.js b/test/auth.test.js index 1d4df175..881732f7 100644 --- a/test/auth.test.js +++ b/test/auth.test.js @@ -7,19 +7,18 @@ const util = require("./_env/util/request"); process.env.CDS_LOG_LEVELS_COV2AP = "debug"; const consoleDebugSpy = jest.spyOn(global.console, "debug"); -consoleDebugSpy.mockImplementation(() => { -}); +consoleDebugSpy.mockImplementation(() => {}); cds.test(__dirname + "/_env"); let request; const validAuth = `Basic ${Buffer.from( - `${cds.requires.auth.users.alice.id}:${cds.requires.auth.users.alice.password}` + `${cds.requires.auth.users.alice.id}:${cds.requires.auth.users.alice.password}`, ).toString("base64")}`; const invalidAuth = `Basic ${Buffer.from( - `${cds.requires.auth.users.bob.id}:${cds.requires.auth.users.bob.password}` + `${cds.requires.auth.users.bob.id}:${cds.requires.auth.users.bob.password}`, ).toString("base64")}`; describe("auth", () => { @@ -30,27 +29,27 @@ describe("auth", () => { it("GET $metadata auth", async () => { let response = await util.callRead(request, "/odata/v2/auth/$metadata", { - accept: "application/xml" + accept: "application/xml", }); expect(response.status).toEqual(401); - expect(response.headers["www-authenticate"]).toEqual("Basic realm=\"Users\""); + expect(response.headers["www-authenticate"]).toEqual('Basic realm="Users"'); response = await util.callRead(request, "/odata/v2/auth/$metadata", { accept: "application/xml", - Authorization: invalidAuth + Authorization: invalidAuth, }); expect(response.status).toEqual(403); response = await util.callRead(request, "/odata/v2/auth/$metadata", { accept: "application/xml", - Authorization: validAuth + Authorization: validAuth, }); expect(response.status).toEqual(200); response = await util.callRead(request, "/odata/v2/auth/$metadata", { accept: "application/xml", Authorization: - "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" + "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", }); expect(response.status).toEqual(401); }); @@ -59,17 +58,17 @@ describe("auth", () => { const consoleSpy = jest.spyOn(console, "error"); let response = await util.callRead(request, "/odata/v2/auth/$metadata", { accept: "application/xml", - Authorization: "Bearer xyz" + Authorization: "Bearer xyz", }); expect(response.status).toEqual(401); expect(consoleSpy).toHaveBeenCalledWith( "[cov2ap] -", "Authorization:", - expect.objectContaining(new Error("Invalid JWT token")) + expect.objectContaining(new Error("Invalid JWT token")), ); response = await util.callRead(request, "/odata/v2/auth/$metadata", { accept: "application/xml", - Authorization: validAuth + Authorization: validAuth, }); expect(response.status).toEqual(200); }); @@ -78,17 +77,17 @@ describe("auth", () => { const consoleSpy = jest.spyOn(console, "error"); let response = await util.callRead(request, "/odata/v2/auth/", { accept: "application/xml", - Authorization: "Bearer xyz" + Authorization: "Bearer xyz", }); expect(response.status).toEqual(401); expect(consoleSpy).toHaveBeenCalledWith( "[cov2ap] -", "Authorization:", - expect.objectContaining(new Error("Invalid JWT token")) + expect.objectContaining(new Error("Invalid JWT token")), ); response = await util.callRead(request, "/odata/v2/auth/", { accept: "application/xml", - Authorization: validAuth + Authorization: validAuth, }); expect(response.status).toEqual(200); }); @@ -96,7 +95,7 @@ describe("auth", () => { it("GET $metadata check response correlation", async () => { const response = await util.callRead(request, "/odata/v2/auth/$metadata", { accept: "application/xml", - Authorization: validAuth + Authorization: validAuth, }); expect(response.status).toEqual(200); expect(response.headers["x-request-id"]).toBeDefined(); @@ -108,18 +107,18 @@ describe("auth", () => { consoleDebugSpy.mockReset(); const response = await util.callRead(request, "/odata/v2/auth/Header", { accept: "application/xml", - Authorization: validAuth + Authorization: validAuth, }); expect(response.status).toEqual(200); - const traceRequest = consoleDebugSpy.mock.calls.find(call => call[1] === "Request:"); + const traceRequest = consoleDebugSpy.mock.calls.find((call) => call[1] === "Request:"); expect(traceRequest).toBeDefined(); - expect(traceRequest[2]).toMatch(/Basic \*\*\*/) - const traceProxyRequest = consoleDebugSpy.mock.calls.find(call => call[1] === "ProxyRequest:"); + expect(traceRequest[2]).toMatch(/Basic \*\*\*/); + const traceProxyRequest = consoleDebugSpy.mock.calls.find((call) => call[1] === "ProxyRequest:"); expect(traceProxyRequest).toBeDefined(); - expect(traceProxyRequest[2]).toMatch(/Basic \*\*\*/) - const traceResponse = consoleDebugSpy.mock.calls.find(call => call[1] === "Response:"); + expect(traceProxyRequest[2]).toMatch(/Basic \*\*\*/); + const traceResponse = consoleDebugSpy.mock.calls.find((call) => call[1] === "Response:"); expect(traceResponse).toBeDefined(); - const traceProxyResponse = consoleDebugSpy.mock.calls.find(call => call[1] === "ProxyResponse:"); + const traceProxyResponse = consoleDebugSpy.mock.calls.find((call) => call[1] === "ProxyResponse:"); expect(traceProxyResponse).toBeDefined(); }); }); diff --git a/test/batch.test.js b/test/batch.test.js index 0ba9229c..7ecf952c 100644 --- a/test/batch.test.js +++ b/test/batch.test.js @@ -112,8 +112,8 @@ describe("batch", () => { expect( third.body.d.results.filter( - (result) => result.name === "Test – ABC" && result.Items.results.length === 1 && result.FirstItem === null - ).length + (result) => result.name === "Test – ABC" && result.Items.results.length === 1 && result.FirstItem === null, + ).length, ).toEqual(1); expect(fourth.body.d.results.filter((result) => result.name === "Test – ABC").length).toEqual(1); @@ -371,7 +371,7 @@ describe("batch", () => { }, }, }, - }) + }), ); expect(first.contentTransferEncoding).toEqual("binary"); expect(second.body).toEqual( @@ -386,7 +386,7 @@ describe("batch", () => { }, }, }, - }) + }), ); expect(second.contentTransferEncoding).toEqual("binary"); }); diff --git a/test/cache.test.js b/test/cache.test.js index ec356b4e..d64a0cba 100644 --- a/test/cache.test.js +++ b/test/cache.test.js @@ -24,21 +24,33 @@ describe("rest", () => { }); it("GET Entity cache via prototype works", async () => { - let response = await util.callWrite(request, "/odata/v2/cache/Header", { - name: "Test" - }, false, { - accept: "application/xml", - }); - expect(response.status).toBe(201) + let response = await util.callWrite( + request, + "/odata/v2/cache/Header", + { + name: "Test", + }, + false, + { + accept: "application/xml", + }, + ); + expect(response.status).toBe(201); expect(response.body).toBeDefined(); - response = await util.callWrite(request, "/odata/v2/cache/HeaderMore", { - name: "Test", - dueAt: "/Date(1711152000000)/" - }, false, { - accept: "application/xml", - }); - expect(response.status).toBe(201) + response = await util.callWrite( + request, + "/odata/v2/cache/HeaderMore", + { + name: "Test", + dueAt: "/Date(1711152000000)/", + }, + false, + { + accept: "application/xml", + }, + ); + expect(response.status).toBe(201); expect(response.body).toBeDefined(); }); }); diff --git a/test/draft.test.js b/test/draft.test.js index 1414dea0..414a3181 100644 --- a/test/draft.test.js +++ b/test/draft.test.js @@ -19,19 +19,19 @@ describe("draft", () => { it("GET service", async () => { const response = await util.callRead(request, "/odata/v2/draft/", { - accept: "application/json" + accept: "application/json", }); expect(response.body).toBeDefined(); expect(response.body).toEqual({ d: { - EntitySets: ["Header", "HeaderItem", "HeaderLine", "Header_texts", "HeaderItem_texts"] - } + EntitySets: ["Header", "HeaderItem", "HeaderLine", "Header_texts", "HeaderItem_texts"], + }, }); }); it("GET $metadata", async () => { const response = await util.callRead(request, "/odata/v2/draft/$metadata", { - accept: "application/xml" + accept: "application/xml", }); expect(response.body).toBeDefined(); expect(response.text).toMatchSnapshot(); @@ -49,7 +49,7 @@ describe("draft", () => { it("GET request with parameters", async () => { let response = await util.callWrite(request, "/odata/v2/draft/Header", { - name: "Test" + name: "Test", }); expect(response.statusCode).toEqual(201); const id = response.body.d.ID; @@ -61,10 +61,10 @@ describe("draft", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`, type: "test.DraftService.Header", - etag: etag + etag: etag, }, HasActiveEntity: false, HasDraftEntity: false, @@ -78,30 +78,30 @@ describe("draft", () => { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items` - } + "localhost", + )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items`, + }, }, SiblingEntity: { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/SiblingEntity` - } + "localhost", + )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/SiblingEntity`, + }, }, DraftAdministrativeData: { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/DraftAdministrativeData` - } - } + "localhost", + )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/DraftAdministrativeData`, + }, + }, }); response = await util.callRead( request, - `/odata/v2/draft/Header?$filter=ID eq guid'${id}' and IsActiveEntity eq false&$select=ID,name&$expand=Items&$skip=0&$top=1&$orderby=name asc` + `/odata/v2/draft/Header?$filter=ID eq guid'${id}' and IsActiveEntity eq false&$select=ID,name&$expand=Items&$skip=0&$top=1&$orderby=name asc`, ); expect(response.body).toBeDefined(); expect(response.body.d.results).toHaveLength(1); @@ -110,7 +110,7 @@ describe("draft", () => { it("POST request", async () => { let response = await util.callWrite(request, "/odata/v2/draft/Header", { - name: "Test Create" + name: "Test Create", }); expect(response.statusCode).toEqual(201); const etag = response.body.d.__metadata.etag; @@ -123,10 +123,10 @@ describe("draft", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`, type: "test.DraftService.Header", - etag: etag + etag: etag, }, HasActiveEntity: false, HasDraftEntity: false, @@ -140,27 +140,27 @@ describe("draft", () => { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items` - } + "localhost", + )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items`, + }, }, SiblingEntity: { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/SiblingEntity` - } + "localhost", + )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/SiblingEntity`, + }, }, DraftAdministrativeData: { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/DraftAdministrativeData` - } - } - } + "localhost", + )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/DraftAdministrativeData`, + }, + }, + }, }); response = await util.callRead(request, "/odata/v2/draft/Header?$filter=name eq 'Test Create'"); expect(response.body).toBeDefined(); @@ -171,10 +171,10 @@ describe("draft", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`, type: "test.DraftService.Header", - etag: etag + etag: etag, }, HasActiveEntity: false, HasDraftEntity: false, @@ -188,33 +188,33 @@ describe("draft", () => { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items` - } + "localhost", + )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items`, + }, }, SiblingEntity: { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/SiblingEntity` - } + "localhost", + )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/SiblingEntity`, + }, }, DraftAdministrativeData: { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/DraftAdministrativeData` - } - } - } + "localhost", + )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/DraftAdministrativeData`, + }, + }, + }, }); response = await util.callRead(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items`); expect(response.body).toBeDefined(); expect(response.body.d.results).toHaveLength(0); response = await util.callWrite(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items`, { - name: "Test Update" + name: "Test Update", }); expect(response.statusCode).toEqual(201); expect(response.body).toBeDefined(); @@ -228,8 +228,8 @@ describe("draft", () => { type: "test.DraftService.HeaderItem", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)` + "localhost", + )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)`, }, HasActiveEntity: false, HasDraftEntity: false, @@ -244,31 +244,31 @@ describe("draft", () => { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)/header` - } + "localhost", + )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)/header`, + }, }, SiblingEntity: { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)/SiblingEntity` - } + "localhost", + )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)/SiblingEntity`, + }, }, DraftAdministrativeData: { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)/DraftAdministrativeData` - } - } - } + "localhost", + )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)/DraftAdministrativeData`, + }, + }, + }, }); response = await util.callRead( request, - `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items(ID=guid'${itemId}',IsActiveEntity=false)` + `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items(ID=guid'${itemId}',IsActiveEntity=false)`, ); expect(response.body).toBeDefined(); expect(response.body).toMatchObject({ @@ -277,8 +277,8 @@ describe("draft", () => { type: "test.DraftService.HeaderItem", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)` + "localhost", + )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)`, }, HasActiveEntity: false, HasDraftEntity: false, @@ -293,33 +293,33 @@ describe("draft", () => { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)/header` - } + "localhost", + )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)/header`, + }, }, SiblingEntity: { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)/SiblingEntity` - } + "localhost", + )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)/SiblingEntity`, + }, }, DraftAdministrativeData: { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)/DraftAdministrativeData` - } - } - } + "localhost", + )}/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)/DraftAdministrativeData`, + }, + }, + }, }); }); it("PUT request", async () => { let response = await util.callWrite(request, "/odata/v2/draft/Header", { - name: "Test" + name: "Test", }); expect(response.body).toBeDefined(); expect(response.statusCode).toEqual(201); @@ -332,9 +332,9 @@ describe("draft", () => { request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`, { - name: "Test2" + name: "Test2", }, - true + true, ); expect(response.statusCode).toEqual(428); @@ -343,12 +343,12 @@ describe("draft", () => { request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`, { - name: "Test2" + name: "Test2", }, true, { - "If-Match": etag - } + "If-Match": etag, + }, ); expect(response.statusCode).toEqual(200); etag = response.body.d.__metadata.etag; @@ -358,12 +358,12 @@ describe("draft", () => { request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`, { - name: "Test3" + name: "Test3", }, true, { - "If-Match": etag - } + "If-Match": etag, + }, ); expect(response.statusCode).toEqual(200); etag = response.body.d.__metadata.etag; @@ -405,9 +405,9 @@ describe("draft", () => { __metadata: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`, - type: "test.DraftService.Header" + type: "test.DraftService.Header", }, createdBy: "anonymous", modifiedBy: "anonymous", @@ -417,11 +417,11 @@ describe("draft", () => { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items` - } - } - } + "localhost", + )}/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items`, + }, + }, + }, }); // Update collection not allowed @@ -429,16 +429,16 @@ describe("draft", () => { request, "/odata/v2/draft/Header", { - name: "Test" + name: "Test", }, - true + true, ); expect(response.body).toMatchObject({ error: { code: "405", message: { lang: "en", - value: "Method PATCH not allowed for ENTITY.COLLECTION" + value: "Method PATCH not allowed for ENTITY.COLLECTION", }, innererror: { errordetails: [ @@ -446,31 +446,31 @@ describe("draft", () => { code: "405", message: { lang: "en", - value: "Method PATCH not allowed for ENTITY.COLLECTION" + value: "Method PATCH not allowed for ENTITY.COLLECTION", }, - severity: "error" - } - ] - } - } + severity: "error", + }, + ], + }, + }, }); }); it("DELETE request", async () => { let response = await util.callWrite(request, "/odata/v2/draft/Header", { - name: "Test" + name: "Test", }); expect(response.body).toBeDefined(); const id = response.body.d.ID; const etag = response.body.d.__metadata.etag; response = await util.callDelete(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`, { - "If-Match": etag + "If-Match": etag, }); expect(response.statusCode).toEqual(204); response = await util.callRead(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`); expect(response.statusCode).toEqual(404); response = await util.callDelete(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`, { - "If-Match": "*" + "If-Match": "*", }); expect(response.statusCode).toEqual(404); expect(response.body).toMatchObject({ @@ -478,7 +478,7 @@ describe("draft", () => { code: "404", message: { lang: "en", - value: "Not Found" + value: "Not Found", }, innererror: { errordetails: [ @@ -486,19 +486,19 @@ describe("draft", () => { code: "404", message: { lang: "en", - value: "Not Found" + value: "Not Found", }, - severity: "error" - } - ] - } - } + severity: "error", + }, + ], + }, + }, }); }); it("POST activate request", async () => { let response = await util.callWrite(request, "/odata/v2/draft/Header", { - name: "Test Create" + name: "Test Create", }); expect(response.statusCode).toEqual(201); expect(response.body).toBeDefined(); @@ -516,8 +516,8 @@ describe("draft", () => { {}, false, { - "If-Match": etag - } + "If-Match": etag, + }, ); expect(response.statusCode).toEqual(200); response = await util.callWrite( @@ -526,8 +526,8 @@ describe("draft", () => { {}, false, { - "If-Match": etag - } + "If-Match": etag, + }, ); expect(response.statusCode).toEqual(201); etag = response.body.d.__metadata.etag; @@ -544,8 +544,8 @@ describe("draft", () => { {}, false, { - "If-Match": etag - } + "If-Match": etag, + }, ); expect(response.statusCode).toEqual(201); response = await util.callRead(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`); @@ -555,7 +555,7 @@ describe("draft", () => { it("DELETE draft request", async () => { let response = await util.callWrite(request, "/odata/v2/draft/Header", { - name: "Test Create" + name: "Test Create", }); expect(response.statusCode).toEqual(201); expect(response.body).toBeDefined(); @@ -565,7 +565,7 @@ describe("draft", () => { expect(response.body).toBeDefined(); expect(response.body.d.ID).toEqual(id); response = await util.callDelete(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`, { - "If-Match": "*" + "If-Match": "*", }); expect(response.statusCode).toEqual(204); response = await util.callRead(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`); @@ -574,7 +574,7 @@ describe("draft", () => { it("DELETE draft for active entity", async () => { let response = await util.callWrite(request, "/odata/v2/draft/Header", { - name: "Test Create" + name: "Test Create", }); expect(response.statusCode).toEqual(201); expect(response.body).toBeDefined(); @@ -591,8 +591,8 @@ describe("draft", () => { {}, false, { - "If-Match": "*" - } + "If-Match": "*", + }, ); expect(response.statusCode).toEqual(200); response = await util.callWrite( @@ -601,8 +601,8 @@ describe("draft", () => { {}, false, { - "If-Match": "*" - } + "If-Match": "*", + }, ); expect(response.statusCode).toEqual(201); response = await util.callRead(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`); @@ -616,14 +616,14 @@ describe("draft", () => { {}, false, { - "If-Match": "*" - } + "If-Match": "*", + }, ); expect(response.statusCode).toEqual(201); response = await util.callRead(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`); expect(response.statusCode).toEqual(200); response = await util.callDelete(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`, { - "If-Match": "*" + "If-Match": "*", }); expect(response.statusCode).toEqual(204); response = await util.callRead(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`); @@ -632,7 +632,7 @@ describe("draft", () => { expect(response.statusCode).toEqual(200); response = await util.callRead( request, - `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=true)?$expand=DraftAdministrativeData%2CSiblingEntity` + `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=true)?$expand=DraftAdministrativeData%2CSiblingEntity`, ); expect(response.statusCode).toEqual(200); expect(response.body.d.ID).toEqual(id); @@ -641,7 +641,7 @@ describe("draft", () => { it("Tests unsupported draft requests", async () => { let response = await util.callWrite(request, "/odata/v2/draft/Header", { - name: "Test Header" + name: "Test Header", }); expect(response.statusCode).toEqual(201); expect(response.body).toBeDefined(); @@ -649,14 +649,14 @@ describe("draft", () => { const id = response.body.d.ID; response = await util.callWrite(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items`, { name: "Test Item", - description: "ABC" + description: "ABC", }); expect(response.statusCode).toEqual(201); expect(response.body).toBeDefined(); expect(response.body.d).toBeDefined(); response = await util.callRead( request, - `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items?$filter=(IsActiveEntity eq true and substringof('Item',name)) or (IsActiveEntity eq false and (substringof('Item',name) or HasActiveEntity eq false))` + `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items?$filter=(IsActiveEntity eq true and substringof('Item',name)) or (IsActiveEntity eq false and (substringof('Item',name) or HasActiveEntity eq false))`, ); expect(response.body).toBeDefined(); expect(response.body.d).toBeDefined(); @@ -672,13 +672,13 @@ describe("draft", () => { assoc_header_ID: null, IsActiveEntity: false, HasDraftEntity: false, - HasActiveEntity: false - } - ] + HasActiveEntity: false, + }, + ], }); response = await util.callRead( request, - `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items?$filter=(IsActiveEntity eq true and (substringof('_',name) or substringof('ABC',description))) or (IsActiveEntity eq false and ((substringof('_',name) or substringof('ABC',description)) or HasActiveEntity eq false))` + `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items?$filter=(IsActiveEntity eq true and (substringof('_',name) or substringof('ABC',description))) or (IsActiveEntity eq false and ((substringof('_',name) or substringof('ABC',description)) or HasActiveEntity eq false))`, ); expect(response.body).toBeDefined(); expect(response.body.d).toBeDefined(); @@ -694,13 +694,13 @@ describe("draft", () => { assoc_header_ID: null, IsActiveEntity: false, HasDraftEntity: false, - HasActiveEntity: false - } - ] + HasActiveEntity: false, + }, + ], }); response = await util.callRead( request, - `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items?$filter=((IsActiveEntity eq true and substringof('Item2',name)) or (IsActiveEntity eq false and (substringof('Item2',name) or HasActiveEntity eq false))) or description eq 'ABC'` + `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items?$filter=((IsActiveEntity eq true and substringof('Item2',name)) or (IsActiveEntity eq false and (substringof('Item2',name) or HasActiveEntity eq false))) or description eq 'ABC'`, ); expect(response.body).toBeDefined(); expect(response.body.d).toBeDefined(); @@ -716,15 +716,15 @@ describe("draft", () => { assoc_header_ID: null, IsActiveEntity: false, HasDraftEntity: false, - HasActiveEntity: false - } - ] + HasActiveEntity: false, + }, + ], }); response = await util.callRead( request, decodeURIComponent( - `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items?$filter=((IsActiveEntity eq true and substringof('Item2',name)) or (IsActiveEntity eq false and (substringof('Item2',name) or HasActiveEntity eq false))) or description eq 'ABC'` - ) + `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items?$filter=((IsActiveEntity eq true and substringof('Item2',name)) or (IsActiveEntity eq false and (substringof('Item2',name) or HasActiveEntity eq false))) or description eq 'ABC'`, + ), ); expect(response.body).toBeDefined(); expect(response.body.d).toBeDefined(); @@ -740,15 +740,15 @@ describe("draft", () => { assoc_header_ID: null, IsActiveEntity: false, HasDraftEntity: false, - HasActiveEntity: false - } - ] + HasActiveEntity: false, + }, + ], }); response = await util.callRead( request, decodeURIComponent( - `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items?$filter=(IsActiveEntity eq true and name eq 'Test Item') or (IsActiveEntity eq false and (name eq 'Test Item' or HasActiveEntity eq false))` - ) + `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items?$filter=(IsActiveEntity eq true and name eq 'Test Item') or (IsActiveEntity eq false and (name eq 'Test Item' or HasActiveEntity eq false))`, + ), ); expect(response.body).toBeDefined(); expect(response.body.d).toBeDefined(); @@ -764,15 +764,15 @@ describe("draft", () => { assoc_header_ID: null, IsActiveEntity: false, HasDraftEntity: false, - HasActiveEntity: false - } - ] + HasActiveEntity: false, + }, + ], }); }); it("Tests draft messages", async () => { let response = await util.callWrite(request, "/odata/v2/draft/Header", { - name: "Test Create" + name: "Test Create", }); expect(response.statusCode).toEqual(201); expect(response.body).toBeDefined(); @@ -781,7 +781,7 @@ describe("draft", () => { let etag = response.body.d.__metadata.etag; response = await util.callWrite(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/texts`, { description: "Test Text", - locale: "en" + locale: "en", }); expect(response.statusCode).toEqual(201); expect(response.body).toBeDefined(); @@ -789,16 +789,20 @@ describe("draft", () => { const textId = response.body.d.ID_texts; expect(textId).toBeDefined(); response = await util.callWrite(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)/Items`, { - name: "Test Item" + name: "Test Item", }); expect(response.statusCode).toEqual(201); expect(response.body).toBeDefined(); expect(response.body.d).toBeDefined(); const itemId = response.body.d.ID; - response = await util.callWrite(request, `/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)/texts`, { - description: "Test Item Text", - locale: "en" - }); + response = await util.callWrite( + request, + `/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)/texts`, + { + description: "Test Item Text", + locale: "en", + }, + ); expect(response.statusCode).toEqual(201); expect(response.body).toBeDefined(); expect(response.body.d).toBeDefined(); @@ -810,15 +814,15 @@ describe("draft", () => { {}, false, { - "If-Match": etag - } + "If-Match": etag, + }, ); expect(JSON.parse(response.headers["sap-message"])).toEqual({ code: "WARN01", details: [], message: "An Warning occurred", severity: "warning", - target: "Header(ID=guid'1b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/name" + target: "Header(ID=guid'1b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/name", }); response = await util.callRead(request, `/odata/v2/draft/HeaderItem(ID=guid'${itemId}',IsActiveEntity=false)`); @@ -828,34 +832,38 @@ describe("draft", () => { name: "Test Item", description: null, startAt: null, - endAt: null + endAt: null, }); expect(JSON.parse(response.headers["sap-message"])).toEqual({ code: "WARN01", details: [], message: "An Warning occurred", severity: "warning", - target: "Items(ID=guid'2b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/name" + target: "Items(ID=guid'2b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/name", }); - response = await util.callRead(request, `/odata/v2/draft/HeaderItem_texts(ID_texts=guid'${itemTextId}',IsActiveEntity=false)`); + response = await util.callRead( + request, + `/odata/v2/draft/HeaderItem_texts(ID_texts=guid'${itemTextId}',IsActiveEntity=false)`, + ); expect(response.body).toBeDefined(); expect(response.body.d).toMatchObject({ ID_texts: itemTextId, - description: "Test Item Text" + description: "Test Item Text", }); expect(JSON.parse(response.headers["sap-message"])).toEqual({ code: "WARN01", details: [], message: "An Warning occurred", severity: "warning", - target: "Items(ID=guid'2b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/texts(ID=guid'3b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/description" + target: + "Items(ID=guid'2b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/texts(ID=guid'3b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/description", }); }); it("Tests transientOnly", async () => { let response = await util.callWrite(request, "/odata/v2/draft/Header", { - name: "Test Create" + name: "Test Create", }); expect(response.statusCode).toEqual(201); expect(response.body).toBeDefined(); @@ -863,66 +871,74 @@ describe("draft", () => { const id = response.body.d.ID; let etag = response.body.d.__metadata.etag; - response = await util.callWrite(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`, { - name: "Test Create - Update 1" - }, true, { - "If-Match": etag - } + response = await util.callWrite( + request, + `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`, + { + name: "Test Create - Update 1", + }, + true, + { + "If-Match": etag, + }, ); expect(response.statusCode).toEqual(200); expect(response.body).toBeDefined(); expect(response.body.d).toBeDefined(); etag = response.body.d.__metadata.etag; - expect(JSON.parse(response.headers["sap-message"])).toEqual( + expect(JSON.parse(response.headers["sap-message"])).toEqual({ + code: "WARN01", + details: [ + { + code: "WARN02", + message: "An Warning occurred 2", + severity: "warning", + target: "/#TRANSIENT#", + }, + { + code: "WARN03", + message: "An Warning occurred 3", + severity: "warning", + target: "/#TRANSIENT#/Header", + }, + ], + message: "An Warning occurred 1", + severity: "warning", + target: "Header(ID=guid'1b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/name", + }); + + response = await util.callWrite( + request, + `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`, + { + name: "Test Create - Update 1", + }, + true, { - code: "WARN01", - details: [ - { - code: "WARN02", - message: "An Warning occurred 2", - severity: "warning", - target: "/#TRANSIENT#" - }, - { - code: "WARN03", - message: "An Warning occurred 3", - severity: "warning", - target: "/#TRANSIENT#/Header" - } - ], - message: "An Warning occurred 1", - severity: "warning", - target: "Header(ID=guid'1b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/name" - }); - - response = await util.callWrite(request, `/odata/v2/draft/Header(ID=guid'${id}',IsActiveEntity=false)`, { - name: "Test Create - Update 1" - }, true, { "If-Match": etag, - "sap-messages": "transientOnly" - } + "sap-messages": "transientOnly", + }, ); expect(response.statusCode).toEqual(200); expect(response.body).toBeDefined(); expect(response.body.d).toBeDefined(); etag = response.body.d.__metadata.etag; - expect(JSON.parse(response.headers["sap-message"])).toEqual( - { - code: "WARN02", - details: [ - { - code: "WARN03", - message: "An Warning occurred 3", - severity: "warning", - target: "/#TRANSIENT#/Header" - } - ], - message: "An Warning occurred 2", - severity: "warning", - target: "/#TRANSIENT#" - }); + expect(JSON.parse(response.headers["sap-message"])).toEqual({ + code: "WARN02", + details: [ + { + code: "WARN03", + message: "An Warning occurred 3", + severity: "warning", + target: "/#TRANSIENT#/Header", + }, + ], + message: "An Warning occurred 2", + severity: "warning", + target: "/#TRANSIENT#", + }); response = await util.callWrite( request, @@ -930,21 +946,21 @@ describe("draft", () => { {}, false, { - "If-Match": etag - } + "If-Match": etag, + }, ); expect(JSON.parse(response.headers["sap-message"])).toEqual({ code: "WARN01", details: [], message: "An Warning occurred", severity: "warning", - target: "Header(ID=guid'1b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/name" + target: "Header(ID=guid'1b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/name", }); }); it("Tests transientOnly (batch)", async () => { let response = await util.callWrite(request, "/odata/v2/draft/Header", { - name: "Test Create" + name: "Test Create", }); expect(response.statusCode).toEqual(201); expect(response.body).toBeDefined(); @@ -965,23 +981,22 @@ describe("draft", () => { expect(response.body).toMatchObject({ d: { ID: id, - name: "Test Create - Update" - } + name: "Test Create - Update", + }, + }); + expect(JSON.parse(response.headers["sap-message"])).toEqual({ + code: "WARN02", + details: [ + { + code: "WARN03", + message: "An Warning occurred 3", + severity: "warning", + target: "/#TRANSIENT#/Header", + }, + ], + message: "An Warning occurred 2", + severity: "warning", + target: "/#TRANSIENT#", }); - expect(JSON.parse(response.headers["sap-message"])).toEqual( - { - code: "WARN02", - details: [ - { - code: "WARN03", - message: "An Warning occurred 3", - severity: "warning", - target: "/#TRANSIENT#/Header" - } - ], - message: "An Warning occurred 2", - severity: "warning", - target: "/#TRANSIENT#" - }); }); }); diff --git a/test/emissions.test.js b/test/emissions.test.js index 22466a57..160c6017 100644 --- a/test/emissions.test.js +++ b/test/emissions.test.js @@ -32,7 +32,7 @@ describe("emissions", () => { type: "userData.EmissionsCalculatorService.UserPreferences", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/emissions-calculator/UserPreferences()`, }, }, @@ -45,7 +45,7 @@ describe("emissions", () => { type: "userData.EmissionsCalculatorService.UserPreferences", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/emissions-calculator/UserPreferences()`, }, }, diff --git a/test/main-xml.test.js b/test/main-xml.test.js index 5caf9867..69aeb5e6 100644 --- a/test/main-xml.test.js +++ b/test/main-xml.test.js @@ -58,14 +58,17 @@ describe("main-xml", () => { it("GET request", async () => { let response = await util.callRead( request, - "/odata/v2/main/Header?$filter=ID eq guid'e0582b6a-6d93-46d9-bd28-98723a285d40'&$format=atom" + "/odata/v2/main/Header?$filter=ID eq guid'e0582b6a-6d93-46d9-bd28-98723a285d40'&$format=atom", ); expect(response.text).toBeDefined(); response.text = cleanResponse(response.text); expect(response.text).toMatchSnapshot(); expect(response.headers["content-type"]).toEqual("application/atom+xml;charset=utf-8"); - response = await util.callRead(request, "/odata/v2/main/Header(guid'e0582b6a-6d93-46d9-bd28-98723a285d40')?$format=atom"); + response = await util.callRead( + request, + "/odata/v2/main/Header(guid'e0582b6a-6d93-46d9-bd28-98723a285d40')?$format=atom", + ); expect(response.text).toBeDefined(); response.text = cleanResponse(response.text); expect(response.headers["content-type"]).toEqual("application/atom+xml;charset=utf-8"); @@ -84,7 +87,7 @@ describe("main-xml", () => { "/odata/v2/main/Header(guid'e0582b6a-6d93-46d9-bd28-98723a285d40')?$expand=Items", { accept: "application/xml", - } + }, ); expect(response.text).toBeDefined(); response.text = cleanResponse(response.text); @@ -99,9 +102,13 @@ describe("main-xml", () => { expect(response.headers["content-type"]).toEqual("application/atom+xml;charset=utf-8"); expect(response.text).toMatchSnapshot(); - response = await util.callRead(request, "/odata/v2/main/Header(guid'e0582b6a-6d93-46d9-bd28-98723a285d40')/name/$value", { - accept: "application/xml", - }); + response = await util.callRead( + request, + "/odata/v2/main/Header(guid'e0582b6a-6d93-46d9-bd28-98723a285d40')/name/$value", + { + accept: "application/xml", + }, + ); expect(response.text).toBeDefined(); response.text = cleanResponse(response.text); expect(response.headers["content-type"]).toEqual("text/plain"); @@ -138,7 +145,7 @@ describe("main-xml", () => { { accept: "application/xml", "content-type": "application/atom+xml", - } + }, ); expect(response.headers["content-type"]).toEqual("application/atom+xml;charset=utf-8"); response.text = cleanResponse(response.text); @@ -229,9 +236,15 @@ describe("main-xml", () => { response.text = cleanResponse(response.text); expect(response.text).toMatchSnapshot(); - response = await util.callWrite(request, "/odata/v2/main/unboundMassActionPrimitive?text1=abc&text2=def", {}, false, { - accept: "application/xml", - }); + response = await util.callWrite( + request, + "/odata/v2/main/unboundMassActionPrimitive?text1=abc&text2=def", + {}, + false, + { + accept: "application/xml", + }, + ); expect(response.headers["content-type"]).toEqual("application/atom+xml;charset=utf-8"); response.text = cleanResponse(response.text); expect(response.text).toMatchSnapshot(); @@ -243,9 +256,15 @@ describe("main-xml", () => { response.text = cleanResponse(response.text); expect(response.text).toMatchSnapshot(); - response = await util.callWrite(request, "/odata/v2/main/unboundMassActionEntity?ids=TEST1&ids='TEST2'", {}, false, { - accept: "application/xml", - }); + response = await util.callWrite( + request, + "/odata/v2/main/unboundMassActionEntity?ids=TEST1&ids='TEST2'", + {}, + false, + { + accept: "application/xml", + }, + ); expect(response.headers["content-type"]).toEqual("application/atom+xml;charset=utf-8"); response.text = cleanResponse(response.text); expect(response.text).toMatchSnapshot(); @@ -254,7 +273,7 @@ describe("main-xml", () => { it("GET error response", async () => { let response = await util.callRead( request, - "/odata/v2/main/Header(guid'a0582b6a-6d93-46d9-bd28-98723a285d40')?$format=atom" + "/odata/v2/main/Header(guid'a0582b6a-6d93-46d9-bd28-98723a285d40')?$format=atom", ); expect(response.text).toBeDefined(); response.text = cleanResponse(response.text); diff --git a/test/main.test.js b/test/main.test.js index 51492dbb..184a258a 100644 --- a/test/main.test.js +++ b/test/main.test.js @@ -121,14 +121,14 @@ describe("main", () => { expect(response.body.d.results).toHaveLength(7); expect(response.body.d.__count).toEqual("7"); const id = response.body.d.results[0].ID; - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ id }')`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${id}')`); expect(response.body.d.__metadata).toEqual({ type: "test.MainService.Header", - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, media_src: undefined, content_type: undefined, }); - response = await util.callRead(request, `/odata/v2/main/HeaderAssocKey(guid'${ id }')`); + response = await util.callRead(request, `/odata/v2/main/HeaderAssocKey(guid'${id}')`); expect(response.body).toBeDefined(); expect(response.status).toEqual(404); expect(response.body.error).toEqual({ @@ -179,16 +179,16 @@ describe("main", () => { expect(response.body).toBeDefined(); expect(response.body.d.results).toHaveLength(1); const ID = response.body.d.results[0].ID; - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ ID }')`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${ID}')`); expect(response.body.d).toBeDefined(); expect(response.body.d.ID).toEqual(ID); - response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${ ID }')`); + response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${ID}')`); expect(response.body.d).toBeDefined(); expect(response.body.d.ID).toEqual(ID); - response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${ ID }')/Items`); + response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${ID}')/Items`); expect(response.body.d.results).toBeDefined(); expect(response.body.d.results.length).toEqual(2); - response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${ ID }')/$links/Items`); + response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${ID}')/$links/Items`); expect(response.body.d.results).toBeDefined(); expect(response.body.d.results.length).toEqual(2); }); @@ -206,14 +206,14 @@ describe("main", () => { const id = response.body.d.ID; response = await util.callRead( request, - `/odata/v2/main/Header?$filter=ID eq guid'${ id }'&$select=ID,name&$expand=FirstItem,Items&$skip=0&$top=1&$orderby=name asc&createdAt=datetime'123456'` + `/odata/v2/main/Header?$filter=ID eq guid'${id}'&$select=ID,name&$expand=FirstItem,Items&$skip=0&$top=1&$orderby=name asc&createdAt=datetime'123456'`, ); expect(response.body).toBeDefined(); expect(response.body.d.results).toMatchObject([ { __metadata: { type: "test.MainService.Header", - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, }, ID: id, FirstItem: null, @@ -252,12 +252,12 @@ describe("main", () => { const id = response.body.d.ID; response = await util.callRead( request, - `/odata/v2/main/Header?$filter=ID eq guid'${ id }'&$expand=Items,Items/header,Items/header/Items&$select=ID,name,Items/ID,Items/name,Items/header/ID,Items/header/name` + `/odata/v2/main/Header?$filter=ID eq guid'${id}'&$expand=Items,Items/header,Items/header/Items&$select=ID,name,Items/ID,Items/name,Items/header/ID,Items/header/name`, ); expect(response.body).toBeDefined(); expect(response.body.d.results[0]).toMatchObject({ __metadata: { - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, type: "test.MainService.Header", }, ID: id, @@ -271,7 +271,7 @@ describe("main", () => { name: "TestItem", header: { __metadata: { - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, type: "test.MainService.Header", }, ID: id, @@ -300,12 +300,12 @@ describe("main", () => { }); response = await util.callRead( request, - `/odata/v2/main/Header?$filter=ID eq guid'${ id }'&$expand=Items&$select=Items/name` + `/odata/v2/main/Header?$filter=ID eq guid'${id}'&$expand=Items&$select=Items/name`, ); expect(response.body).toBeDefined(); expect(response.body.d.results[0]).toMatchObject({ __metadata: { - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, type: "test.MainService.Header", }, ID: id, @@ -343,62 +343,62 @@ describe("main", () => { expect(response.statusCode).toEqual(201); const id = response.body.d.ID; const itemId = response.body.d.Items.results[0].ID; - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${ id }'&$select=ID,name`); + response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${id}'&$select=ID,name`); expect(response.body).toBeDefined(); expect(response.body.d.results).toEqual([ { __metadata: { type: "test.MainService.Header", - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, }, ID: id, name: "Test", }, ]); - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${ id }'&$select=ID,name,Items`); + response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${id}'&$select=ID,name,Items`); expect(response.body).toBeDefined(); expect(response.body.d.results).toEqual([ { __metadata: { type: "test.MainService.Header", - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, }, ID: id, name: "Test", Items: { __deferred: { - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')/Items`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')/Items`, }, }, }, ]); - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${ id }'&$select=ID,name,Items/ID`); + response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${id}'&$select=ID,name,Items/ID`); expect(response.body).toBeDefined(); expect(response.body.d.results).toEqual([ { __metadata: { type: "test.MainService.Header", - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, }, ID: id, name: "Test", Items: { __deferred: { - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')/Items`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')/Items`, }, }, }, ]); response = await util.callRead( request, - `/odata/v2/main/Header?$filter=ID eq guid'${ id }'&$select=ID,name,Items/ID&$expand=Items` + `/odata/v2/main/Header?$filter=ID eq guid'${id}'&$select=ID,name,Items/ID&$expand=Items`, ); expect(response.body).toBeDefined(); expect(response.body.d.results).toEqual([ { __metadata: { type: "test.MainService.Header", - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, }, ID: id, name: "Test", @@ -408,10 +408,10 @@ describe("main", () => { ID: itemId, __metadata: { type: "test.MainService.HeaderItem", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderItem(guid'${ itemId }')`, + "localhost", + )}/odata/v2/main/HeaderItem(guid'${itemId}')`, }, }, ], @@ -430,7 +430,7 @@ describe("main", () => { }); expect(response.statusCode).toEqual(201); response = await util.callWrite(request, "/odata/v2/main/Header", { - name: 'hall\\ooo', + name: "hall\\ooo", }); expect(response.statusCode).toEqual(201); response = await util.callWrite(request, "/odata/v2/main/Header", { @@ -483,7 +483,7 @@ describe("main", () => { }); expect(response.statusCode).toEqual(201); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header/$count?$filter=ID eq guid'${ id }'`); + response = await util.callRead(request, `/odata/v2/main/Header/$count?$filter=ID eq guid'${id}'`); expect(response.text).toEqual("1"); }); @@ -493,13 +493,13 @@ describe("main", () => { }); expect(response.statusCode).toEqual(201); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ id }')/ID`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${id}')/ID`); expect(response.body).toEqual({ d: { ID: id, }, }); - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ id }')/ID/$value`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${id}')/ID/$value`); expect(response.headers["content-type"]).toEqual("text/plain"); expect(response.text).toEqual(id); }); @@ -510,19 +510,21 @@ describe("main", () => { }); expect(response.statusCode).toEqual(201); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/HeaderDelta?!deltatoken='${ new Date().getTime() }'`); + response = await util.callRead(request, `/odata/v2/main/HeaderDelta?!deltatoken='${new Date().getTime()}'`); expect(response.statusCode).toEqual(200); expect(response.body.d.results).toBeDefined(); - expect(response.body.d.__delta).toMatch(/http:\/\/localhost:(\d*)\/odata\/v2\/main\/HeaderDelta\?!deltatoken='(\d*)'/); - response = await util.callRead(request, `/odata/v2/main/HeaderDelta(guid'${ id }')`); + expect(response.body.d.__delta).toMatch( + /http:\/\/localhost:(\d*)\/odata\/v2\/main\/HeaderDelta\?!deltatoken='(\d*)'/, + ); + response = await util.callRead(request, `/odata/v2/main/HeaderDelta(guid'${id}')`); expect(response.statusCode).toEqual(200); expect(response.body.d.results).toBeUndefined(); - response = await util.callRead(request, `/odata/v2/main/HeaderDelta(guid'${ id }')/Items?$filter=name eq 'a /'`); + response = await util.callRead(request, `/odata/v2/main/HeaderDelta(guid'${id}')/Items?$filter=name eq 'a /'`); expect(response.statusCode).toEqual(200); expect(response.body.d.results).toBeDefined(); expect(response.body.d.__delta).toMatch( - /http:\/\/localhost:(\d*)\/odata\/v2\/main\/HeaderDelta\(guid'.*?'\)\/Items\?\$filter=name eq 'a \/'&!deltatoken='(\d*)'/ + /http:\/\/localhost:(\d*)\/odata\/v2\/main\/HeaderDelta\(guid'.*?'\)\/Items\?\$filter=name eq 'a \/'&!deltatoken='(\d*)'/, ); }); @@ -550,17 +552,17 @@ describe("main", () => { it("GET request with stream", async () => { const id = "f8a7a4f7-1901-4032-a237-3fba1d1b2343"; - let response = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + let response = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(response.body.d).toEqual({ ID: id, __metadata: { content_type: "image/png", - media_src: `http://${ response.request.host.replace( + media_src: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderStream(guid'${ id }')/$value`, + "localhost", + )}/odata/v2/main/HeaderStream(guid'${id}')/$value`, type: "test.MainService.HeaderStream", - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/HeaderStream(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/HeaderStream(guid'${id}')`, }, custom: null, filename: "file.png", @@ -568,14 +570,19 @@ describe("main", () => { mediaType: "image/png", totalAmount: null, }); - const mediaSrc = response.body.d.__metadata.media_src.substr(response.body.d.__metadata.media_src.indexOf("/odata/v2")); + const mediaSrc = response.body.d.__metadata.media_src.substr( + response.body.d.__metadata.media_src.indexOf("/odata/v2"), + ); response = await util.callRead(request, mediaSrc); expect(response.statusCode).toEqual(200); expect(response.body.length).toBe(17686); expect(response.headers["transfer-encoding"]).toEqual("chunked"); expect(response.headers["content-type"]).toEqual("image/png"); expect(response.headers["content-disposition"]).toEqual('attachment; filename="file.png"'); - response = await util.callRead(request, "/odata/v2/main/HeaderStream(guid'f8a7a4f7-1901-4032-a237-3fba1d1b2343')/data"); + response = await util.callRead( + request, + "/odata/v2/main/HeaderStream(guid'f8a7a4f7-1901-4032-a237-3fba1d1b2343')/data", + ); expect(response.statusCode).toEqual(200); expect(response.body.length).toBe(17686); expect(response.headers["transfer-encoding"]).toEqual("chunked"); @@ -583,14 +590,17 @@ describe("main", () => { expect(response.headers["content-disposition"]).toEqual('attachment; filename="file.png"'); response = await util.callRead( request, - "/odata/v2/main/HeaderStream(guid'f8a7a4f7-1901-4032-a237-3fba1d1b2343')/data/$value" + "/odata/v2/main/HeaderStream(guid'f8a7a4f7-1901-4032-a237-3fba1d1b2343')/data/$value", ); expect(response.statusCode).toEqual(200); expect(response.body.length).toBe(17686); expect(response.headers["transfer-encoding"]).toEqual("chunked"); expect(response.headers["content-type"]).toEqual("image/png"); expect(response.headers["content-disposition"]).toEqual('attachment; filename="file.png"'); - response = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'f8a7a4f7-1901-4032-a237-3fba1d1b2343')/$value`); + response = await util.callRead( + request, + `/odata/v2/main/HeaderStream(guid'f8a7a4f7-1901-4032-a237-3fba1d1b2343')/$value`, + ); expect(response.statusCode).toEqual(200); expect(response.body.length).toBe(17686); expect(response.headers["transfer-encoding"]).toEqual("chunked"); @@ -598,7 +608,7 @@ describe("main", () => { expect(response.headers["content-disposition"]).toEqual('attachment; filename="file.png"'); response = await util.callRead( request, - "/odata/v2/main/HeaderStreamAttachment(guid'f8a7a4f7-1901-4032-a237-3fba1d1b2343')/$value" + "/odata/v2/main/HeaderStreamAttachment(guid'f8a7a4f7-1901-4032-a237-3fba1d1b2343')/$value", ); expect(response.statusCode).toEqual(200); expect(response.body.length).toBe(17686); @@ -613,12 +623,12 @@ describe("main", () => { "/odata/v2/main/HeaderUrlStream(guid'f8a7a4f7-1901-4032-a237-3fba1d1b2343')/link", { accept: "image/png", - } + }, ); expect(response.statusCode).toEqual(200); response = await util.callRead( request, - "/odata/v2/main/HeaderUrlStream(guid'f8a7a4f7-1901-4032-a237-3fba1d1b2343')/link" + "/odata/v2/main/HeaderUrlStream(guid'f8a7a4f7-1901-4032-a237-3fba1d1b2343')/link", ); expect(response.statusCode).toEqual(200); expect(response.body.length).toBe(17686); @@ -628,7 +638,7 @@ describe("main", () => { expect(response.statusCode).toEqual(200); response = await util.callRead( request, - "/odata/v2/main/HeaderUrlStream(guid'f8a7a4f7-1901-4032-a237-3fba1d1b2343')/link/$value" + "/odata/v2/main/HeaderUrlStream(guid'f8a7a4f7-1901-4032-a237-3fba1d1b2343')/link/$value", ); expect(response.statusCode).toEqual(200); expect(response.body.length).toBe(17686); @@ -637,7 +647,7 @@ describe("main", () => { expect(response.headers["content-disposition"]).toEqual('attachment; filename="file.png"'); response = await util.callRead( request, - "/odata/v2/main/HeaderUrlStream(guid'f8a7a4f7-1901-4032-a237-3fba1d1b2343')/$value" + "/odata/v2/main/HeaderUrlStream(guid'f8a7a4f7-1901-4032-a237-3fba1d1b2343')/$value", ); expect(response.statusCode).toEqual(200); expect(response.body.length).toBe(17686); @@ -646,7 +656,7 @@ describe("main", () => { expect(response.headers["content-disposition"]).toEqual('attachment; filename="file.png"'); response = await util.callRead( request, - "/odata/v2/main/HeaderUrlStream(guid'e8a7a4f7-1901-4032-a237-3fba1d1b2343')/$value" + "/odata/v2/main/HeaderUrlStream(guid'e8a7a4f7-1901-4032-a237-3fba1d1b2343')/$value", ); expect(response.statusCode).toEqual(500); expect(response.body.error.cause.code).toEqual("ECONNREFUSED"); @@ -655,7 +665,7 @@ describe("main", () => { "/odata/v2/main/HeaderUrlStream(guid'a8a7a4f7-1901-4032-a237-3fba1d1b2343')/$value", { accept: "image/png", - } + }, ); expect(response.statusCode).toEqual(400); expect(response.body).toEqual({ @@ -695,24 +705,24 @@ describe("main", () => { expect(createResponse.statusCode).toEqual(201); const id = createResponse.body.d.ID; const stream = fs.createReadStream(__dirname + "/_env/srv/init/assets/file.png"); - const req = util.callStream(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`, true, { + const req = util.callStream(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`, true, { "content-type": "image/png", }); req.expect(204); stream.on("end", async () => { req.end(async (err) => { if (!err) { - let readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + let readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(readResponse.statusCode).toEqual(200); expect(readResponse.headers["content-type"]).toEqual("image/png"); expect(readResponse.body.length).toEqual(17686); - let deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + let deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(deleteResponse.statusCode).toEqual(204); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(readResponse.statusCode).toEqual(204); - deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(deleteResponse.statusCode).toEqual(204); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(readResponse.statusCode).toEqual(404); } done(err); @@ -732,21 +742,21 @@ describe("main", () => { }); expect(createResponse.statusCode).toEqual(201); const id = createResponse.body.d.ID; - const dataResponse = await util.callBinary(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`, file, true, { + const dataResponse = await util.callBinary(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`, file, true, { "content-type": "image/png", }); expect(dataResponse.statusCode).toEqual(204); - let readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + let readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(readResponse.statusCode).toEqual(200); expect(readResponse.headers["content-type"]).toEqual("image/png"); expect(readResponse.body.length).toEqual(17686); - let deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + let deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(deleteResponse.statusCode).toEqual(204); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(readResponse.statusCode).toEqual(204); - deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(deleteResponse.statusCode).toEqual(204); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(readResponse.statusCode).toEqual(404); }); @@ -765,7 +775,7 @@ describe("main", () => { req.end(async (err, createResponse) => { if (!err) { const id = createResponse.body.d.ID; - let readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + let readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(readResponse.statusCode).toEqual(200); expect(readResponse.body.d).toMatchObject({ ID: id, @@ -775,17 +785,17 @@ describe("main", () => { totalAmount: 11, isBlocked: true, }); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(readResponse.statusCode).toEqual(200); expect(readResponse.headers["content-type"]).toEqual("image/png"); expect(readResponse.body.length).toEqual(17686); - let deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + let deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(deleteResponse.statusCode).toEqual(204); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(readResponse.statusCode).toEqual(204); - deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(deleteResponse.statusCode).toEqual(204); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(readResponse.statusCode).toEqual(404); } done(err); @@ -807,7 +817,7 @@ describe("main", () => { }); expect(createResponse.statusCode).toEqual(201); const id = createResponse.body.d.ID; - let readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + let readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(readResponse.statusCode).toEqual(200); expect(readResponse.body.d).toMatchObject({ ID: id, @@ -817,17 +827,17 @@ describe("main", () => { totalAmount: 11, isBlocked: false, }); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(readResponse.statusCode).toEqual(200); expect(readResponse.headers["content-type"]).toEqual("image/png"); expect(readResponse.body.length).toEqual(17686); - let deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + let deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(deleteResponse.statusCode).toEqual(204); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(readResponse.statusCode).toEqual(204); - deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(deleteResponse.statusCode).toEqual(204); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(readResponse.statusCode).toEqual(404); }); @@ -842,7 +852,7 @@ describe("main", () => { }); expect(createResponse.statusCode).toEqual(201); const id = createResponse.body.d.ID; - let readResponse = await util.callRead(request, `/odata/v2/main/HeaderStreamDecode(guid'${ id }')`); + let readResponse = await util.callRead(request, `/odata/v2/main/HeaderStreamDecode(guid'${id}')`); expect(readResponse.statusCode).toEqual(200); expect(readResponse.body.d).toMatchObject({ ID: id, @@ -852,17 +862,17 @@ describe("main", () => { totalAmount: 11, isBlocked: false, }); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStreamDecode(guid'${ id }')/data`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStreamDecode(guid'${id}')/data`); expect(readResponse.statusCode).toEqual(200); expect(readResponse.headers["content-type"]).toEqual("image/png"); expect(readResponse.body.length).toEqual(17686); - let deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStreamDecode(guid'${ id }')/data`); + let deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStreamDecode(guid'${id}')/data`); expect(deleteResponse.statusCode).toEqual(204); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStreamDecode(guid'${ id }')/data`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStreamDecode(guid'${id}')/data`); expect(readResponse.statusCode).toEqual(204); - deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStreamDecode(guid'${ id }')`); + deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStreamDecode(guid'${id}')`); expect(deleteResponse.statusCode).toEqual(204); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStreamDecode(guid'${ id }')`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStreamDecode(guid'${id}')`); expect(readResponse.statusCode).toEqual(404); }); @@ -882,11 +892,11 @@ describe("main", () => { custom: "test123", totalAmount: "11", isBlocked: "true", - } + }, ); expect(createResponse.statusCode).toEqual(201); const id = createResponse.body.d.ID; - let readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + let readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(readResponse.statusCode).toEqual(200); expect(readResponse.body.d).toMatchObject({ ID: id, @@ -896,17 +906,17 @@ describe("main", () => { totalAmount: 11, isBlocked: true, }); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(readResponse.statusCode).toEqual(200); expect(readResponse.headers["content-type"]).toEqual("image/png"); expect(readResponse.body.length).toEqual(17686); - let deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + let deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(deleteResponse.statusCode).toEqual(204); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(readResponse.statusCode).toEqual(204); - deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(deleteResponse.statusCode).toEqual(204); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(readResponse.statusCode).toEqual(404); }); @@ -923,11 +933,11 @@ describe("main", () => { custom: "test123", totalAmount: "11", isBlocked: "false", - } + }, ); expect(createResponse.statusCode).toEqual(201); const id = createResponse.body.d.ID; - let readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + let readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(readResponse.statusCode).toEqual(200); expect(readResponse.body.d).toMatchObject({ ID: id, @@ -937,17 +947,17 @@ describe("main", () => { totalAmount: 11, isBlocked: false, }); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(readResponse.statusCode).toEqual(200); expect(readResponse.headers["content-type"]).toEqual("image/png"); expect(readResponse.body.length).toEqual(17686); - let deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + let deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(deleteResponse.statusCode).toEqual(204); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')/data`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')/data`); expect(readResponse.statusCode).toEqual(204); - deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + deleteResponse = await util.callDelete(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(deleteResponse.statusCode).toEqual(204); - readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${ id }')`); + readResponse = await util.callRead(request, `/odata/v2/main/HeaderStream(guid'${id}')`); expect(readResponse.statusCode).toEqual(404); }); @@ -1030,12 +1040,12 @@ describe("main", () => { }); expect(response.statusCode).toEqual(201); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${ id }'&$expand=Items`); + response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${id}'&$expand=Items`); expect(response.body).toBeDefined(); let data = response.body.d.results[0]; expect(data).toMatchObject({ __metadata: { - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, type: "test.MainService.Header", }, ID: id, @@ -1053,14 +1063,14 @@ describe("main", () => { }); data.name = "Test2"; data.Items.results[0].name = "TestItem2"; - response = await util.callWrite(request, `/odata/v2/main/Header(guid'${ id }')`, data, true); + response = await util.callWrite(request, `/odata/v2/main/Header(guid'${id}')`, data, true); expect(response.statusCode).toEqual(200); - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${ id }'&$expand=Items`); + response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${id}'&$expand=Items`); expect(response.body).toBeDefined(); data = response.body.d.results[0]; expect(data).toMatchObject({ __metadata: { - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, type: "test.MainService.Header", }, ID: id, @@ -1084,57 +1094,69 @@ describe("main", () => { }); expect(response.statusCode).toEqual(201); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${ id }' and substringof('ES',name)`); + response = await util.callRead( + request, + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof('ES',name)`, + ); expect(response.body.d.results).toHaveLength(1); response = await util.callRead( request, - `/odata/v2/main/Header?$filter=ID eq guid'${ id }' and substringof('es',tolower(name))` + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof('es',tolower(name))`, ); expect(response.body.d.results).toHaveLength(1); response = await util.callRead( request, - `/odata/v2/main/Header?$filter=ID eq guid'${ id }' and substringof('es',tolower(name)) or name eq 'ABC'` + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof('es',tolower(name)) or name eq 'ABC'`, ); expect(response.body.d.results).toHaveLength(1); response = await util.callRead( request, - `/odata/v2/main/Header?$filter=ID eq guid'${ id }' and substringof('es',tolower(name))%20or%20name%20eq 'ABC'` + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof('es',tolower(name))%20or%20name%20eq 'ABC'`, ); expect(response.body.d.results).toHaveLength(1); response = await util.callRead( request, - `/odata/v2/main/Header?$filter=ID eq guid'${ id }' and substringof('es',tolower(name)) or substringof(')es , ''''and (t) substringof(''es'',tolower(name))',tolower(name))` + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof('es',tolower(name)) or substringof(')es , ''''and (t) substringof(''es'',tolower(name))',tolower(name))`, ); expect(response.body.d.results).toHaveLength(1); response = await util.callRead( request, - `/odata/v2/main/Header?$filter=(ID eq guid'${ id }' and (substringof('es',tolower(name)) or (substringof(')es , ''''and (t) substringof(''es'',tolower(name))',tolower(name)))))` + `/odata/v2/main/Header?$filter=(ID eq guid'${id}' and (substringof('es',tolower(name)) or (substringof(')es , ''''and (t) substringof(''es'',tolower(name))',tolower(name)))))`, ); expect(response.body.d.results).toHaveLength(1); response = await util.callRead( request, - `/odata/v2/main/Header?$filter=ID eq guid'${ id }' and substringof(tolower('ES'),tolower(name))` + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof(tolower('ES'),tolower(name))`, ); expect(response.body.d.results).toHaveLength(1); response = await util.callRead( request, - `/odata/v2/main/Header?$filter=ID eq guid'${ id }' and substringof(tolower(tolower('ES')),tolower(tolower(name)))` + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof(tolower(tolower('ES')),tolower(tolower(name)))`, ); expect(response.body.d.results).toHaveLength(1); - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${ id }' and substringof('es', name)`); + response = await util.callRead( + request, + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof('es', name)`, + ); expect(response.body.d.results).toHaveLength(1); - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${ id }' and substringof( 'es',name)`); + response = await util.callRead( + request, + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof( 'es',name)`, + ); expect(response.body.d.results).toHaveLength(1); response = await util.callRead( request, - `/odata/v2/main/Header?$filter=ID eq guid'${ id }' and substringof( tolower('es'), tolower(name))` + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof( tolower('es'), tolower(name))`, ); expect(response.body.d.results).toHaveLength(1); response = await util.callWrite(request, "/odata/v2/main/Header", { name: "substringof('es',name)", }); expect(response.statusCode).toEqual(201); - response = await util.callRead(request, `/odata/v2/main/Header?$filter=substringof('substringof(''es'',name)',name)`); + response = await util.callRead( + request, + `/odata/v2/main/Header?$filter=substringof('substringof(''es'',name)',name)`, + ); expect(response.body.d.results).toHaveLength(1); }); @@ -1144,11 +1166,20 @@ describe("main", () => { }); expect(response.statusCode).toEqual(201); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${ id }' and substringof('st$',name)`); + response = await util.callRead( + request, + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof('st$',name)`, + ); expect(response.body.d.results).toHaveLength(1); - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${ id }' and substringof('$',name)`); + response = await util.callRead( + request, + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof('$',name)`, + ); expect(response.body.d.results).toHaveLength(1); - response = await util.callRead(request, `/odata/v2/main/Header?$filter=ID eq guid'${ id }' and substringof('$$',name)`); + response = await util.callRead( + request, + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and substringof('$$',name)`, + ); expect(response.body.d.results).toHaveLength(0); }); @@ -1160,17 +1191,17 @@ describe("main", () => { const id = response.body.d.ID; response = await util.callRead( request, - `/odata/v2/main/Header?$filter=ID eq guid'${ id }' or substringof('er',createdBy) or startswith(createdBy,'By')&$select=ID,name,createdBy` + `/odata/v2/main/Header?$filter=ID eq guid'${id}' or substringof('er',createdBy) or startswith(createdBy,'By')&$select=ID,name,createdBy`, ); expect(response.body.d.results).toHaveLength(1); response = await util.callRead( request, - `/odata/v2/main/Header?$filter=ID eq guid'${ id }' and startswith(createdBy,'ANO')&$select=ID,name,createdBy` + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and startswith(createdBy,'ANO')&$select=ID,name,createdBy`, ); expect(response.body.d.results).toHaveLength(1); response = await util.callRead( request, - `/odata/v2/main/Header?$filter=ID eq guid'${ id }' and endswith(createdBy,'MOUS')&$select=ID,name,createdBy` + `/odata/v2/main/Header?$filter=ID eq guid'${id}' and endswith(createdBy,'MOUS')&$select=ID,name,createdBy`, ); expect(response.body.d.results).toHaveLength(1); }); @@ -1212,14 +1243,14 @@ describe("main", () => { ID: "2b089301-0d04-4005-b45c-c8ee801212a7", name: "TestItem1001", startAt: "/Date(1586815200000)/", - NextItem_ID: "3b089301-0d04-4005-b45c-c8ee801212a7" + NextItem_ID: "3b089301-0d04-4005-b45c-c8ee801212a7", }, { ID: "3b089301-0d04-4005-b45c-c8ee801212a7", name: "TestItem1002", startAt: "/Date(1586815200000)/", - NextItem_ID: "2b089301-0d04-4005-b45c-c8ee801212a7" - } + NextItem_ID: "2b089301-0d04-4005-b45c-c8ee801212a7", + }, ], }); expect(response.statusCode).toBe(201); @@ -1229,17 +1260,17 @@ describe("main", () => { expect(response.body.d.results[0].Items.results).toHaveLength(2); response = await util.callRead( request, - "/odata/v2/main/Header?$expand=FirstItem&$filter=stock eq 1001 and FirstItem/NextItem/name eq 'TestItem1002'" + "/odata/v2/main/Header?$expand=FirstItem&$filter=stock eq 1001 and FirstItem/NextItem/name eq 'TestItem1002'", ); expect(response.body.d.results).toHaveLength(1); response = await util.callRead( request, - "/odata/v2/main/Header?$expand=FirstItem&$filter=stock eq 1001 and FirstItem/startAt eq datetimeoffset'2020-04-13T22:00:00.000Z'" + "/odata/v2/main/Header?$expand=FirstItem&$filter=stock eq 1001 and FirstItem/startAt eq datetimeoffset'2020-04-13T22:00:00.000Z'", ); expect(response.body.d.results).toHaveLength(1); response = await util.callRead( request, - "/odata/v2/main/Header?$expand=FirstItem&$filter=FirstItem/name eq 'TestItem1001'" + "/odata/v2/main/Header?$expand=FirstItem&$filter=FirstItem/name eq 'TestItem1001'", ); expect(response.body.d.results).toHaveLength(1); }); @@ -1251,7 +1282,7 @@ describe("main", () => { }); expect(response.statusCode).toEqual(201); const ID = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ ID }')`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${ID}')`); expect(response.body.d).toMatchObject({ ID, name: "Test %22", @@ -1276,14 +1307,14 @@ describe("main", () => { const id = response.body.d.ID; expect(id).toBeDefined(); expect(response.headers.location).toEqual( - `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')` + `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, ); let itemId = response.body.d.Items.results[0].ID; expect(itemId).toBeDefined(); expect(response.body).toMatchObject({ d: { __metadata: { - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, type: "test.MainService.Header", }, ID: id, @@ -1313,11 +1344,11 @@ describe("main", () => { response = await util.callRead(request, "/odata/v2/main/Header?$filter=name eq 'Test Create'"); expect(response.body).toBeDefined(); expect(response.body.d.results).toHaveLength(1); - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ id }')`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${id}')`); expect(response.body).toMatchObject({ d: { __metadata: { - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, type: "test.MainService.Header", }, createdBy: "anonymous", @@ -1326,15 +1357,15 @@ describe("main", () => { description: null, Items: { __deferred: { - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')/Items`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')/Items`, }, }, }, }); - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ id }')/Items`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${id}')/Items`); expect(response.body).toBeDefined(); expect(response.body.d.results).toHaveLength(1); - response = await util.callWrite(request, `/odata/v2/main/Header(guid'${ id }')/Items`, { + response = await util.callWrite(request, `/odata/v2/main/Header(guid'${id}')/Items`, { name: "Test Update", }); expect(response.statusCode).toEqual(201); @@ -1344,7 +1375,7 @@ describe("main", () => { expect(response.body).toMatchObject({ d: { __metadata: { - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/HeaderItem(guid'${ itemId }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/HeaderItem(guid'${itemId}')`, type: "test.MainService.HeaderItem", }, name: "Test Update", @@ -1354,20 +1385,20 @@ describe("main", () => { header_ID: id, header: { __deferred: { - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderItem(guid'${ itemId }')/header`, + "localhost", + )}/odata/v2/main/HeaderItem(guid'${itemId}')/header`, }, }, }, }); - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ id }')/Items(guid'${ itemId }')`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${id}')/Items(guid'${itemId}')`); expect(response.body).toBeDefined(); expect(response.body).toMatchObject({ d: { __metadata: { - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/HeaderItem(guid'${ itemId }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/HeaderItem(guid'${itemId}')`, type: "test.MainService.HeaderItem", }, name: "Test Update", @@ -1377,10 +1408,10 @@ describe("main", () => { header_ID: id, header: { __deferred: { - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderItem(guid'${ itemId }')/header`, + "localhost", + )}/odata/v2/main/HeaderItem(guid'${itemId}')/header`, }, }, }, @@ -1412,14 +1443,14 @@ describe("main", () => { const id = response.body.d.ID; expect(id).toBeDefined(); expect(response.headers.location).toEqual( - `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')` + `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, ); let itemId = response.body.d.Items.results[0].ID; expect(itemId).toBeDefined(); expect(response.body).toMatchObject({ d: { __metadata: { - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, type: "test.MainService.Header", }, ID: id, @@ -1453,18 +1484,18 @@ describe("main", () => { const id = response.body.d.ID; response = await util.callWrite( request, - `/odata/v2/main/Header(guid'${ id }')`, + `/odata/v2/main/Header(guid'${id}')`, { name: "Test2", }, - true + true, ); expect(response.statusCode).toEqual(200); - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ id }')`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${id}')`); expect(response.body).toMatchObject({ d: { __metadata: { - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, type: "test.MainService.Header", }, createdBy: "anonymous", @@ -1473,7 +1504,7 @@ describe("main", () => { description: null, Items: { __deferred: { - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')/Items`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')/Items`, }, }, }, @@ -1484,7 +1515,7 @@ describe("main", () => { { name: "Test", }, - true + true, ); expect(response.body).toMatchObject({ error: { @@ -1520,7 +1551,7 @@ describe("main", () => { let id = response.body.d.ID; expect(id).toBeDefined(); expect(response.body.d.name).toEqual("Test: èèòàù"); - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ id }')`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${id}')`); expect(response.statusCode).toEqual(200); expect(response.body.d.name).toEqual("Test: èèòàù"); expect(response.headers["content-type"]).toEqual("application/json"); @@ -1534,7 +1565,7 @@ describe("main", () => { false, { "content-type": "application/json; charset=utf-8", - } + }, ); expect(response.statusCode).toEqual(201); expect(response.body).toBeDefined(); @@ -1542,7 +1573,7 @@ describe("main", () => { id = response.body.d.ID; expect(id).toBeDefined(); expect(response.body.d.name).toEqual("Test: èèòàù"); - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ id }')`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${id}')`); expect(response.statusCode).toEqual(200); expect(response.body.d.name).toEqual("Test: èèòàù"); expect(response.headers["content-type"]).toEqual("application/json"); @@ -1556,14 +1587,14 @@ describe("main", () => { const id = response.body.d.ID; response = await util.callWrite( request, - `/odata/v2/main/Header(guid'${ id }')`, + `/odata/v2/main/Header(guid'${id}')`, { name: "Test2", }, false, { "x-http-method": "MERGE", - } + }, ); expect(response.statusCode).toEqual(200); expect(response.body.d.name).toEqual("Test2"); @@ -1576,19 +1607,19 @@ describe("main", () => { expect(response.body).toBeDefined(); let body = response.body; const id = body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ id }')`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${id}')`); body = response.body; body.d.name = "Test2"; - response = await util.callWrite(request, `/odata/v2/main/Header(guid'${ id }')`, body.d, true); + response = await util.callWrite(request, `/odata/v2/main/Header(guid'${id}')`, body.d, true); expect(response.statusCode).toEqual(200); - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ id }')`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${id}')`); expect(response.body.d.name).toEqual("Test2"); - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ id }')?$expand=Items,FirstItem`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${id}')?$expand=Items,FirstItem`); body = response.body; body.d.name = "Test3"; - response = await util.callWrite(request, `/odata/v2/main/Header(guid'${ id }')`, body.d, true); + response = await util.callWrite(request, `/odata/v2/main/Header(guid'${id}')`, body.d, true); expect(response.statusCode).toEqual(200); - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ id }')`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${id}')`); expect(response.body.d.name).toEqual("Test3"); }); @@ -1598,11 +1629,11 @@ describe("main", () => { }); expect(response.body).toBeDefined(); const id = response.body.d.ID; - response = await util.callDelete(request, `/odata/v2/main/Header(guid'${ id }')`); + response = await util.callDelete(request, `/odata/v2/main/Header(guid'${id}')`); expect(response.statusCode).toEqual(204); - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ id }')`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${id}')`); expect(response.statusCode).toEqual(404); - response = await util.callDelete(request, `/odata/v2/main/Header(guid'${ id }')`); + response = await util.callDelete(request, `/odata/v2/main/Header(guid'${id}')`); expect(response.statusCode).toEqual(404); expect(response.body).toMatchObject({ error: { @@ -1960,12 +1991,12 @@ describe("main", () => { }); expect(response.statusCode).toEqual(201); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/unboundNavigationFunction?num=1&text=${ id }`); + response = await util.callRead(request, `/odata/v2/main/unboundNavigationFunction?num=1&text=${id}`); expect(response.body).toMatchObject({ d: { __metadata: { type: "test.MainService.Header", - uri: `http://${ response.request.host.replace("127.0.0.1", "localhost") }/odata/v2/main/Header(guid'${ id }')`, + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Header(guid'${id}')`, }, createdBy: "anonymous", modifiedBy: "anonymous", @@ -2006,7 +2037,7 @@ describe("main", () => { }); expect(response.body).toBeDefined(); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header_boundFunction?ID=guid'${ id }'&num=1&text=abc`); + response = await util.callRead(request, `/odata/v2/main/Header_boundFunction?ID=guid'${id}'&num=1&text=abc`); expect(response.body).toMatchObject({ d: { Header_boundFunction: { @@ -2019,7 +2050,7 @@ describe("main", () => { }, }, }); - response = await util.callRead(request, `/odata/v2/main/Header_boundFunction?ID=guid'${ id }'&num=1&text=a%20b%2Fc`); + response = await util.callRead(request, `/odata/v2/main/Header_boundFunction?ID=guid'${id}'&num=1&text=a%20b%2Fc`); expect(response.body).toMatchObject({ d: { Header_boundFunction: { @@ -2040,7 +2071,10 @@ describe("main", () => { }); expect(response.body).toBeDefined(); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header_boundMassFunction?ID=guid'${ id }'&ids=TEST1&ids='TEST2'`); + response = await util.callRead( + request, + `/odata/v2/main/Header_boundMassFunction?ID=guid'${id}'&ids=TEST1&ids='TEST2'`, + ); expect(response.body).toMatchObject({ d: { results: [ @@ -2071,7 +2105,7 @@ describe("main", () => { }); expect(response.body).toBeDefined(); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header_boundFunctionPrimitive?ID=guid'${ id }'&num=1`); + response = await util.callRead(request, `/odata/v2/main/Header_boundFunctionPrimitive?ID=guid'${id}'&num=1`); expect(response.body).toMatchObject({ d: { Header_boundFunctionPrimitive: 1, @@ -2079,7 +2113,7 @@ describe("main", () => { }); response = await util.callRead( request, - `/odata/v2/main/Header_boundMassFunctionPrimitive?ID=guid'${ id }'&text1=abc&text2=def` + `/odata/v2/main/Header_boundMassFunctionPrimitive?ID=guid'${id}'&text1=abc&text2=def`, ); expect(response.body).toMatchObject({ d: { @@ -2094,7 +2128,10 @@ describe("main", () => { }); expect(response.body).toBeDefined(); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header_boundFunctionPrimitiveString?ID=guid'${ id }'&text=abc`); + response = await util.callRead( + request, + `/odata/v2/main/Header_boundFunctionPrimitiveString?ID=guid'${id}'&text=abc`, + ); expect(response.body).toMatchObject({ d: { Header_boundFunctionPrimitiveString: "abc", @@ -2102,7 +2139,7 @@ describe("main", () => { }); response = response = await util.callRead( request, - `/odata/v2/main/Header_boundFunctionPrimitiveLargeString?ID=guid'${ id }'&text=abc` + `/odata/v2/main/Header_boundFunctionPrimitiveLargeString?ID=guid'${id}'&text=abc`, ); expect(response.body).toMatchObject({ d: { @@ -2117,7 +2154,7 @@ describe("main", () => { }); expect(response.body).toBeDefined(); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header_boundFunctionEntity?ID=guid'${ id }'&num=1&text=test`); + response = await util.callRead(request, `/odata/v2/main/Header_boundFunctionEntity?ID=guid'${id}'&num=1&text=test`); expect(response.body).toMatchObject({ d: { __metadata: { @@ -2133,7 +2170,7 @@ describe("main", () => { }); response = await util.callRead( request, - `/odata/v2/main/Header_boundMassFunctionEntity?ID=guid'${ id }'&ids=TEST1&ids='TEST2'` + `/odata/v2/main/Header_boundMassFunctionEntity?ID=guid'${id}'&ids=TEST1&ids='TEST2'`, ); expect(response.body).toMatchObject({ d: { @@ -2171,7 +2208,7 @@ describe("main", () => { }); expect(response.body).toBeDefined(); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header_boundErrorFunction?ID=guid'${ id }'`); + response = await util.callRead(request, `/odata/v2/main/Header_boundErrorFunction?ID=guid'${id}'`); expect(response.body).toMatchObject({ error: { code: "ERR01", @@ -2179,8 +2216,8 @@ describe("main", () => { lang: "en", value: "An error occurred", }, - target: `Header(ID=guid'${ id }',IsActiveEntity=false)/name`, - additionalTargets: [`Header(ID=guid'${ id }',IsActiveEntity=false)/description`], + target: `Header(ID=guid'${id}',IsActiveEntity=false)/name`, + additionalTargets: [`Header(ID=guid'${id}',IsActiveEntity=false)/description`], severity: "error", ContentID: "1", innererror: { @@ -2206,7 +2243,7 @@ describe("main", () => { }); expect(response.body).toBeDefined(); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header_boundWarningFunction?ID=guid'${ id }'`); + response = await util.callRead(request, `/odata/v2/main/Header_boundWarningFunction?ID=guid'${id}'`); expect(response.body).toMatchObject({ d: { Header_boundWarningFunction: { @@ -2233,8 +2270,8 @@ describe("main", () => { ], message: "An Warning occurred", severity: expect.stringMatching(/info|warning/), - target: `Header(ID=guid'${ id }',IsActiveEntity=false)/name`, - additionalTargets: [`Header(ID=guid'${ id }',IsActiveEntity=false)/description`], + target: `Header(ID=guid'${id}',IsActiveEntity=false)/name`, + additionalTargets: [`Header(ID=guid'${id}',IsActiveEntity=false)/description`], ContentID: "1", }); }); @@ -2507,8 +2544,8 @@ describe("main", () => { }, target: "name", severity: "error", - ContentID: "1" - } + ContentID: "1", + }, }); response = await util.callWrite(request, "/odata/v2/main/unboundErrorAction?num=1&text=unchecked"); expect(response.body).toMatchObject({ @@ -2520,8 +2557,8 @@ describe("main", () => { }, target: "_xXx123", severity: "error", - ContentID: "1" - } + ContentID: "1", + }, }); response = await util.callWrite(request, "/odata/v2/main/unboundErrorAction?num=1&text=relative"); expect(response.body).toMatchObject({ @@ -2533,8 +2570,8 @@ describe("main", () => { }, target: "Header(ID=guid'1b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/name", severity: "error", - ContentID: "1" - } + ContentID: "1", + }, }); response = await util.callWrite(request, "/odata/v2/main/unboundErrorAction?num=1&text=guid"); expect(response.body).toMatchObject({ @@ -2546,8 +2583,8 @@ describe("main", () => { }, target: "Header(ID=guid'1b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/name", severity: "error", - ContentID: "1" - } + ContentID: "1", + }, }); response = await util.callWrite(request, "/odata/v2/main/unboundErrorAction?num=1&text=absolute"); expect(response.body).toMatchObject({ @@ -2559,8 +2596,8 @@ describe("main", () => { }, target: "/Header(ID=guid'1b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/name", severity: "error", - ContentID: "1" - } + ContentID: "1", + }, }); response = await util.callWrite(request, "/odata/v2/main/unboundErrorAction?num=1&text=transient"); expect(response.body).toMatchObject({ @@ -2572,8 +2609,8 @@ describe("main", () => { }, target: "/#TRANSIENT#", severity: "error", - ContentID: "1" - } + ContentID: "1", + }, }); response = await util.callWrite(request, "/odata/v2/main/unboundErrorAction?num=1&text=transientpath"); expect(response.body).toMatchObject({ @@ -2585,8 +2622,8 @@ describe("main", () => { }, target: "/#TRANSIENT#/Header(ID=guid'1b750773-bb1b-4565-8a33-79c99440e4e8',IsActiveEntity=false)/name", severity: "error", - ContentID: "1" - } + ContentID: "1", + }, }); response = await util.callWrite(request, "/odata/v2/main/unboundErrorAction?num=1&text=invalid"); expect(response.body).toMatchObject({ @@ -2598,8 +2635,8 @@ describe("main", () => { }, target: "Header2(ID=1b750773-bb1b-4565-8a33-79c99440e4e8,IsActiveEntity=false)/name2", severity: "error", - ContentID: "1" - } + ContentID: "1", + }, }); }); @@ -2609,7 +2646,7 @@ describe("main", () => { }); expect(response.body).toBeDefined(); const id = response.body.d.ID; - response = await util.callWrite(request, `/odata/v2/main/Header_boundAction?ID=guid'${ id }'&num=1&text=abc`); + response = await util.callWrite(request, `/odata/v2/main/Header_boundAction?ID=guid'${id}'&num=1&text=abc`); expect(response.body).toMatchObject({ d: { Header_boundAction: { @@ -2622,7 +2659,7 @@ describe("main", () => { }, }, }); - response = await util.callWrite(request, `/odata/v2/main/Header_boundActionInline?ID=guid'${ id }'&num=1&text=abc`); + response = await util.callWrite(request, `/odata/v2/main/Header_boundActionInline?ID=guid'${id}'&num=1&text=abc`); expect(response.body).toMatchObject({ d: { Header_boundActionInline: { @@ -2635,7 +2672,7 @@ describe("main", () => { }, }, }); - response = await util.callWrite(request, `/odata/v2/main/Header_boundAction?ID=guid'${ id }'&num=1&text=a%20b%2Fc`); + response = await util.callWrite(request, `/odata/v2/main/Header_boundAction?ID=guid'${id}'&num=1&text=a%20b%2Fc`); expect(response.body).toMatchObject({ d: { Header_boundAction: { @@ -2656,7 +2693,7 @@ describe("main", () => { }); expect(response.body).toBeDefined(); const id = response.body.d.ID; - response = await util.callWrite(request, `/odata/v2/main/Header_boundActionPrimitive?ID=guid'${ id }'&num=1`); + response = await util.callWrite(request, `/odata/v2/main/Header_boundActionPrimitive?ID=guid'${id}'&num=1`); expect(response.body).toMatchObject({ d: { Header_boundActionPrimitive: 1, @@ -2664,7 +2701,7 @@ describe("main", () => { }); response = await util.callWrite( request, - `/odata/v2/main/Header_boundMassActionPrimitive?ID=guid'${ id }'&text1=abc&text2=def` + `/odata/v2/main/Header_boundMassActionPrimitive?ID=guid'${id}'&text1=abc&text2=def`, ); expect(response.body).toMatchObject({ d: { @@ -2679,13 +2716,19 @@ describe("main", () => { }); expect(response.body).toBeDefined(); const id = response.body.d.ID; - response = await util.callWrite(request, `/odata/v2/main/Header_boundActionPrimitiveString?ID=guid'${ id }'&text=abc`); + response = await util.callWrite( + request, + `/odata/v2/main/Header_boundActionPrimitiveString?ID=guid'${id}'&text=abc`, + ); expect(response.body).toMatchObject({ d: { Header_boundActionPrimitiveString: "abc", }, }); - response = await util.callWrite(request, `/odata/v2/main/Header_boundActionPrimitiveLargeString?ID=guid'${ id }'&text=abc`); + response = await util.callWrite( + request, + `/odata/v2/main/Header_boundActionPrimitiveLargeString?ID=guid'${id}'&text=abc`, + ); expect(response.body).toMatchObject({ d: { Header_boundActionPrimitiveLargeString: "abc", @@ -2699,7 +2742,7 @@ describe("main", () => { }); expect(response.body).toBeDefined(); const id = response.body.d.ID; - response = await util.callWrite(request, `/odata/v2/main/Header_boundMassAction?ID=guid'${ id }'&ids=TEST1`); + response = await util.callWrite(request, `/odata/v2/main/Header_boundMassAction?ID=guid'${id}'&ids=TEST1`); expect(response.body).toMatchObject({ d: { results: [ @@ -2714,7 +2757,10 @@ describe("main", () => { ], }, }); - response = await util.callWrite(request, `/odata/v2/main/Header_boundMassAction?ID=guid'${ id }'&ids=TEST1&ids='TEST2'`); + response = await util.callWrite( + request, + `/odata/v2/main/Header_boundMassAction?ID=guid'${id}'&ids=TEST1&ids='TEST2'`, + ); expect(response.body).toMatchObject({ d: { results: [ @@ -2739,7 +2785,7 @@ describe("main", () => { }); response = await util.callWrite( request, - `/odata/v2/main/Header_boundMassActionInline?ID=guid'${ id }'&ids=TEST1&ids='TEST2'` + `/odata/v2/main/Header_boundMassActionInline?ID=guid'${id}'&ids=TEST1&ids='TEST2'`, ); expect(response.body).toMatchObject({ d: { @@ -2771,7 +2817,7 @@ describe("main", () => { }); expect(response.body).toBeDefined(); const id = response.body.d.ID; - response = await util.callWrite(request, `/odata/v2/main/Header_boundActionNoReturn?ID=guid'${ id }'&num=1&text=abc`); + response = await util.callWrite(request, `/odata/v2/main/Header_boundActionNoReturn?ID=guid'${id}'&num=1&text=abc`); expect(response.body).toEqual({}); }); @@ -2781,7 +2827,7 @@ describe("main", () => { }); expect(response.body).toBeDefined(); const id = response.body.d.ID; - response = await util.callWrite(request, `/odata/v2/main/Header_boundActionEntity?ID=guid'${ id }'&num=1&text=test`); + response = await util.callWrite(request, `/odata/v2/main/Header_boundActionEntity?ID=guid'${id}'&num=1&text=test`); expect(response.body).toMatchObject({ d: { __metadata: { @@ -2797,7 +2843,7 @@ describe("main", () => { }); response = await util.callWrite( request, - `/odata/v2/main/Header_boundMassActionEntity?ID=guid'${ id }'&ids=TEST1&ids='TEST2'` + `/odata/v2/main/Header_boundMassActionEntity?ID=guid'${id}'&ids=TEST1&ids='TEST2'`, ); expect(response.body).toMatchObject({ d: { @@ -2835,12 +2881,12 @@ describe("main", () => { ID, }); expect(response.statusCode).toEqual(201); - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ ID }')`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${ID}')`); expect(response.body && response.body.d).toBeDefined(); expect(response.body.d).toEqual( expect.objectContaining({ ID, - }) + }), ); }); @@ -2850,7 +2896,7 @@ describe("main", () => { expect(response.body && response.body.d && response.body.d.results).toBeDefined(); response.body.d.results.forEach((result) => { result.__metadata.uri = result.__metadata.uri.substr( - `http://${ response.request.host.replace("127.0.0.1", "localhost") }`.length + `http://${response.request.host.replace("127.0.0.1", "localhost")}`.length, ); }); expect(response.body && response.body.d).toMatchSnapshot(); @@ -2867,11 +2913,11 @@ describe("main", () => { expect(response.body && response.body.d).toBeDefined(); let data = response.body && response.body.d; data.__metadata.uri = data.__metadata.uri.substr( - `http://${ response.request.host.replace("127.0.0.1", "localhost") }`.length + `http://${response.request.host.replace("127.0.0.1", "localhost")}`.length, ); const id = data.__metadata.uri.substring( data.__metadata.uri.indexOf("'") + 1, - data.__metadata.uri.lastIndexOf("'") + data.__metadata.uri.lastIndexOf("'"), ); let name = decodeURIComponent(id); name = name.replace(/''/g, "'"); @@ -2887,11 +2933,11 @@ describe("main", () => { value, }); - response = await util.callRead(request, `/odata/v2/main/Favorite?$filter=name eq '${ id }'`); + response = await util.callRead(request, `/odata/v2/main/Favorite?$filter=name eq '${id}'`); expect(response.statusCode).toEqual(200); data = response.body && response.body.d && response.body.d.results && response.body.d.results[0]; data.__metadata.uri = data.__metadata.uri.substr( - `http://${ response.request.host.replace("127.0.0.1", "localhost") }`.length + `http://${response.request.host.replace("127.0.0.1", "localhost")}`.length, ); expect(data).toEqual({ __metadata: { @@ -2910,7 +2956,7 @@ describe("main", () => { expect(response.body && response.body.d && response.body.d.results).toBeDefined(); response.body.d.results.forEach((result) => { result.__metadata.uri = result.__metadata.uri.substr( - `http://${ response.request.host.replace("127.0.0.1", "localhost") }`.length + `http://${response.request.host.replace("127.0.0.1", "localhost")}`.length, ); }); expect(response.body && response.body.d).toMatchSnapshot(); @@ -2934,69 +2980,69 @@ describe("main", () => { }); expect(response.statusCode).toEqual(201); let id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${ id }')`, { + response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${id}')`, { "x-forwarded-proto": "https", "x-forwarded-host": "test:1234", - "x-forwarded-path": `/xyz/odata/v2/main/Header(ID=guid'${ id }')`, + "x-forwarded-path": `/xyz/odata/v2/main/Header(ID=guid'${id}')`, }); expect(response.statusCode).toEqual(200); expect(response.body.d).toMatchObject({ name: "Test", __metadata: { type: "test.MainService.Header", - uri: `https://test:1234/xyz/odata/v2/main/Header(guid'${ id }')`, + uri: `https://test:1234/xyz/odata/v2/main/Header(guid'${id}')`, }, }); - response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${ id }')`, { + response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${id}')`, { "x-forwarded-proto": "https", "x-forwarded-host": "test:1234", - "x-forwarded-path": `/abc/v3/Header(ID=guid'${ id }')/toRootHeader`, + "x-forwarded-path": `/abc/v3/Header(ID=guid'${id}')/toRootHeader`, }); expect(response.statusCode).toEqual(200); expect(response.body.d).toMatchObject({ name: "Test", __metadata: { type: "test.MainService.Header", - uri: `https://test:1234/abc/v3/Header(guid'${ id }')`, + uri: `https://test:1234/abc/v3/Header(guid'${id}')`, }, }); - response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${ id }')`, { + response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${id}')`, { "x-forwarded-proto": "https", "x-forwarded-host": "test:1234", - "x-forwarded-path": `/cockpit/Header(ID=guid'${ id }')`, + "x-forwarded-path": `/cockpit/Header(ID=guid'${id}')`, }); expect(response.statusCode).toEqual(200); expect(response.body.d).toMatchObject({ name: "Test", __metadata: { type: "test.MainService.Header", - uri: `https://test:1234/cockpit/Header(guid'${ id }')`, + uri: `https://test:1234/cockpit/Header(guid'${id}')`, }, }); - response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${ id }')`, { + response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${id}')`, { "x-forwarded-proto": "https", "x-forwarded-host": "test:1234", - "x-forwarded-path": `/cockpit/odata/v2/Header(ID=guid'${ id }')`, + "x-forwarded-path": `/cockpit/odata/v2/Header(ID=guid'${id}')`, }); expect(response.statusCode).toEqual(200); expect(response.body.d).toMatchObject({ name: "Test", __metadata: { type: "test.MainService.Header", - uri: `https://test:1234/cockpit/odata/v2/Header(guid'${ id }')`, + uri: `https://test:1234/cockpit/odata/v2/Header(guid'${id}')`, }, }); - response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${ id }')`, { + response = await util.callRead(request, `/odata/v2/main/Header(ID=guid'${id}')`, { "x-forwarded-proto": "https", "x-forwarded-host": "test:1234", - "x-forwarded-path": `https://test:1234/cockpit/odata/v2/Header(ID=guid'${ id }')`, + "x-forwarded-path": `https://test:1234/cockpit/odata/v2/Header(ID=guid'${id}')`, }); expect(response.statusCode).toEqual(200); expect(response.body.d).toMatchObject({ name: "Test", __metadata: { type: "test.MainService.Header", - uri: `https://test:1234/cockpit/odata/v2/Header(guid'${ id }')`, + uri: `https://test:1234/cockpit/odata/v2/Header(guid'${id}')`, }, }); response = await util.callRead(request, "/odata/v2/main/Header", { @@ -3009,7 +3055,7 @@ describe("main", () => { expect(response.body.d.results[0]).toMatchObject({ __metadata: { type: "test.MainService.Header", - uri: `https://test:1234/cockpit/odata/v2/Header(guid'${ response.body.d.results[0].ID }')`, + uri: `https://test:1234/cockpit/odata/v2/Header(guid'${response.body.d.results[0].ID}')`, }, }); response = await util.callRead(request, "/odata/v2/main/Header?a=b", { @@ -3022,37 +3068,37 @@ describe("main", () => { expect(response.body.d.results[0]).toMatchObject({ __metadata: { type: "test.MainService.Header", - uri: `https://test:1234/cockpit/odata/v2/Header(guid'${ response.body.d.results[0].ID }')`, + uri: `https://test:1234/cockpit/odata/v2/Header(guid'${response.body.d.results[0].ID}')`, }, }); - response = await util.callRead(request, `/odata/v2/main/unboundNavigationFunction?num=1&text=${ id }`, { + response = await util.callRead(request, `/odata/v2/main/unboundNavigationFunction?num=1&text=${id}`, { "x-forwarded-proto": "https", "x-forwarded-host": "test:1234", - "x-forwarded-path": `/cockpit/unboundNavigationFunction?num=1&text=${ id }`, + "x-forwarded-path": `/cockpit/unboundNavigationFunction?num=1&text=${id}`, }); expect(response.statusCode).toEqual(200); expect(response.body.d).toMatchObject({ __metadata: { type: "test.MainService.Header", - uri: `https://test:1234/cockpit/Header(guid'${ response.body.d.ID }')`, + uri: `https://test:1234/cockpit/Header(guid'${response.body.d.ID}')`, }, }); - response = await util.callRead(request, `/odata/v2/main/unboundNavigationFunction?num=1&text=${ id }`, { + response = await util.callRead(request, `/odata/v2/main/unboundNavigationFunction?num=1&text=${id}`, { "x-forwarded-proto": "https", "x-forwarded-host": "test:1234", - "x-forwarded-path": `/cockpit/odata/v2/unboundNavigationFunction?num=1&text=${ id }`, + "x-forwarded-path": `/cockpit/odata/v2/unboundNavigationFunction?num=1&text=${id}`, }); expect(response.statusCode).toEqual(200); expect(response.body.d).toMatchObject({ __metadata: { type: "test.MainService.Header", - uri: `https://test:1234/cockpit/odata/v2/Header(guid'${ response.body.d.ID }')`, + uri: `https://test:1234/cockpit/odata/v2/Header(guid'${response.body.d.ID}')`, }, }); - response = await util.callRead(request, `/odata/v2/main/Header_boundFunction?ID=guid'${ id }'&num=1&text=abc`, { + response = await util.callRead(request, `/odata/v2/main/Header_boundFunction?ID=guid'${id}'&num=1&text=abc`, { "x-forwarded-proto": "https", "x-forwarded-host": "test:1234", - "x-forwarded-path": `/cockpit/odata/v2/Header_boundFunction?ID=guid'${ id }'&num=1&text=abc`, + "x-forwarded-path": `/cockpit/odata/v2/Header_boundFunction?ID=guid'${id}'&num=1&text=abc`, }); expect(response.statusCode).toEqual(200); expect(response.body).toMatchObject({ @@ -3072,15 +3118,15 @@ describe("main", () => { }); expect(response.statusCode).toEqual(201); id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/HeaderDelta?!deltatoken='${ new Date().getTime() }'`, { + response = await util.callRead(request, `/odata/v2/main/HeaderDelta?!deltatoken='${new Date().getTime()}'`, { "x-forwarded-proto": "https", "x-forwarded-host": "test:1234", - "x-forwarded-path": `/cockpit/HeaderDelta?!deltatoken='${ new Date().getTime() }'`, + "x-forwarded-path": `/cockpit/HeaderDelta?!deltatoken='${new Date().getTime()}'`, }); expect(response.statusCode).toEqual(200); expect(response.body.d.results).toBeDefined(); expect(response.body.d.__delta).toMatch(/https:\/\/test:1234\/cockpit\/HeaderDelta\?!deltatoken='(\d*)'/); - response = await util.callRead(request, `/odata/v2/main/HeaderDelta(guid'${ id }')`); + response = await util.callRead(request, `/odata/v2/main/HeaderDelta(guid'${id}')`); expect(response.statusCode).toEqual(200); expect(response.body.d.results).toBeUndefined(); response = await util.callRead(request, "/odata/v2/main/$metadata", { @@ -3137,7 +3183,7 @@ describe("main", () => { expect(response.body).toBeDefined(); expect(response.body.d.name).toEqual("Schöne Träume"); const id = response.body.d.ID; - response = await util.callRead(request, `/odata/v2/main/Header(guid'${ id }')`); + response = await util.callRead(request, `/odata/v2/main/Header(guid'${id}')`); expect(response.body.d.name).toEqual("Schöne Träume"); }); @@ -3149,18 +3195,18 @@ describe("main", () => { { Items: { __deferred: { - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderLargeString(name='A',country='DE')/Items`, + "localhost", + )}/odata/v2/main/HeaderLargeString(name='A',country='DE')/Items`, }, }, __metadata: { type: "test.MainService.HeaderLargeString", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderLargeString(name='A',country='DE')`, + "localhost", + )}/odata/v2/main/HeaderLargeString(name='A',country='DE')`, }, country: "DE", currency: "EUR", @@ -3170,18 +3216,18 @@ describe("main", () => { { Items: { __deferred: { - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderLargeString(name='B',country='US')/Items`, + "localhost", + )}/odata/v2/main/HeaderLargeString(name='B',country='US')/Items`, }, }, __metadata: { type: "test.MainService.HeaderLargeString", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderLargeString(name='B',country='US')`, + "localhost", + )}/odata/v2/main/HeaderLargeString(name='B',country='US')`, }, country: "US", currency: "USD", @@ -3193,18 +3239,18 @@ describe("main", () => { expect(response.body.d).toEqual({ Items: { __deferred: { - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderLargeString(name='A',country='DE')/Items`, + "localhost", + )}/odata/v2/main/HeaderLargeString(name='A',country='DE')/Items`, }, }, __metadata: { type: "test.MainService.HeaderLargeString", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderLargeString(name='A',country='DE')`, + "localhost", + )}/odata/v2/main/HeaderLargeString(name='A',country='DE')`, }, country: "DE", currency: "EUR", @@ -3216,17 +3262,17 @@ describe("main", () => { { __metadata: { type: "test.MainService.HeaderItemLargeString", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderItemLargeString(name='a',position='1')`, + "localhost", + )}/odata/v2/main/HeaderItemLargeString(name='a',position='1')`, }, header: { __deferred: { - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderItemLargeString(name='a',position='1')/header`, + "localhost", + )}/odata/v2/main/HeaderItemLargeString(name='a',position='1')/header`, }, }, header_country: "DE", @@ -3238,17 +3284,17 @@ describe("main", () => { { __metadata: { type: "test.MainService.HeaderItemLargeString", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderItemLargeString(name='a',position='2')`, + "localhost", + )}/odata/v2/main/HeaderItemLargeString(name='a',position='2')`, }, header: { __deferred: { - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderItemLargeString(name='a',position='2')/header`, + "localhost", + )}/odata/v2/main/HeaderItemLargeString(name='a',position='2')/header`, }, }, header_country: "DE", @@ -3341,7 +3387,7 @@ describe("main", () => { message: { lang: "en", value: expect.stringMatching( - /Deserialization Error: Invalid value 0123456789a \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./ + /Deserialization Error: Invalid value 0123456789a \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./, ), }, severity: "error", @@ -3353,7 +3399,7 @@ describe("main", () => { message: { lang: "en", value: expect.stringMatching( - /Deserialization Error: Invalid value 0123456789a \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./ + /Deserialization Error: Invalid value 0123456789a \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./, ), }, severity: "error", @@ -3371,7 +3417,7 @@ describe("main", () => { message: { lang: "en", value: expect.stringMatching( - /Deserialization Error: Invalid value 0123456789a \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./ + /Deserialization Error: Invalid value 0123456789a \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./, ), }, severity: "error", @@ -3383,7 +3429,7 @@ describe("main", () => { message: { lang: "en", value: expect.stringMatching( - /Deserialization Error: Invalid value 0123456789a \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./ + /Deserialization Error: Invalid value 0123456789a \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./, ), }, severity: "error", @@ -3415,7 +3461,7 @@ describe("main", () => { message: { lang: "en", value: expect.stringMatching( - /Deserialization Error: Invalid value "01234\n5678" \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./ + /Deserialization Error: Invalid value "01234\n5678" \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./, ), }, severity: "error", @@ -3427,7 +3473,7 @@ describe("main", () => { message: { lang: "en", value: expect.stringMatching( - /Deserialization Error: Invalid value "01234\n5678" \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./ + /Deserialization Error: Invalid value "01234\n5678" \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./, ), }, severity: "error", @@ -3445,7 +3491,7 @@ describe("main", () => { message: { lang: "en", value: expect.stringMatching( - /Deserialization Error: Invalid value 01234\n56789 \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./ + /Deserialization Error: Invalid value 01234\n56789 \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./, ), }, severity: "error", @@ -3457,7 +3503,7 @@ describe("main", () => { message: { lang: "en", value: expect.stringMatching( - /Deserialization Error: Invalid value 01234\n56789 \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./ + /Deserialization Error: Invalid value 01234\n56789 \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./, ), }, severity: "error", @@ -3503,7 +3549,7 @@ describe("main", () => { message: { lang: "en", value: expect.stringMatching( - /Deserialization Error: Invalid value """""\n""""" \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./ + /Deserialization Error: Invalid value """""\n""""" \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./, ), }, severity: "error", @@ -3515,7 +3561,7 @@ describe("main", () => { message: { lang: "en", value: expect.stringMatching( - /Deserialization Error: Invalid value """""\n""""" \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./ + /Deserialization Error: Invalid value """""\n""""" \((?:JavaScript )?string\) for property \\?"text\\?"\. The length of the Edm\.String value must not be greater than the MaxLength facet value \(10\)\./, ), }, severity: "error", @@ -3552,10 +3598,10 @@ describe("main", () => { name: "Test", __metadata: { type: "test.MainService.context_Name_space_v2", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/context_Name_space_v2(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, + "localhost", + )}/odata/v2/main/context_Name_space_v2(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, }, }, ], @@ -3563,7 +3609,7 @@ describe("main", () => { }); response = await util.callRead( request, - "/odata/v2/main/context_Name_space_v2(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')" + "/odata/v2/main/context_Name_space_v2(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')", ); expect(response.body).toMatchObject({ d: { @@ -3571,10 +3617,10 @@ describe("main", () => { name: "Test", __metadata: { type: "test.MainService.context_Name_space_v2", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/context_Name_space_v2(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, + "localhost", + )}/odata/v2/main/context_Name_space_v2(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, }, }, }); @@ -3590,63 +3636,63 @@ describe("main", () => { name: "Test-DE", texts: { __deferred: { - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/texts`, + "localhost", + )}/odata/v2/main/LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/texts`, }, }, localized: { __deferred: { - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/localized`, + "localhost", + )}/odata/v2/main/LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/localized`, }, }, __metadata: { type: "test.MainService.LocalizedEntity", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, + "localhost", + )}/odata/v2/main/LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, }, }, ], }, }); const id = response.body.d.results[0].ID; - response = await util.callRead(request, `/odata/v2/main/LocalizedEntity(guid'${ id }')`); + response = await util.callRead(request, `/odata/v2/main/LocalizedEntity(guid'${id}')`); expect(response.body).toMatchObject({ d: { ID: "36a0b287-eae5-46f7-80a8-f3eb2f9bb328", name: "Test-DE", texts: { __deferred: { - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/texts`, + "localhost", + )}/odata/v2/main/LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/texts`, }, }, localized: { __deferred: { - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/localized`, + "localhost", + )}/odata/v2/main/LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/localized`, }, }, __metadata: { type: "test.MainService.LocalizedEntity", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, + "localhost", + )}/odata/v2/main/LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, }, }, }); - response = await util.callRead(request, `/odata/v2/main/LocalizedEntity(guid'${ id }')/texts`); + response = await util.callRead(request, `/odata/v2/main/LocalizedEntity(guid'${id}')/texts`); expect(response.body).toMatchObject({ d: { results: [ @@ -3656,10 +3702,10 @@ describe("main", () => { name: "Test-DE", __metadata: { type: "test.MainService.LocalizedEntity_texts", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/LocalizedEntity_texts(locale='en',ID=guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, + "localhost", + )}/odata/v2/main/LocalizedEntity_texts(locale='en',ID=guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, }, }, ], @@ -3667,7 +3713,7 @@ describe("main", () => { }); response = await util.callRead( request, - "/odata/v2/main/LocalizedEntity_texts(locale='en',ID=guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')" + "/odata/v2/main/LocalizedEntity_texts(locale='en',ID=guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')", ); expect(response.statusCode).toEqual(405); expect(response.body).toMatchObject({ @@ -3707,63 +3753,63 @@ describe("main", () => { name: "Test-DE", texts: { __deferred: { - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/context_LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/texts`, + "localhost", + )}/odata/v2/main/context_LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/texts`, }, }, localized: { __deferred: { - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/context_LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/localized`, + "localhost", + )}/odata/v2/main/context_LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/localized`, }, }, __metadata: { type: "test.MainService.context_LocalizedEntity", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/context_LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, + "localhost", + )}/odata/v2/main/context_LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, }, }, ], }, }); const id = response.body.d.results[0].ID; - response = await util.callRead(request, `/odata/v2/main/context_LocalizedEntity(guid'${ id }')`); + response = await util.callRead(request, `/odata/v2/main/context_LocalizedEntity(guid'${id}')`); expect(response.body).toMatchObject({ d: { ID: "36a0b287-eae5-46f7-80a8-f3eb2f9bb328", name: "Test-DE", texts: { __deferred: { - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/context_LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/texts`, + "localhost", + )}/odata/v2/main/context_LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/texts`, }, }, localized: { __deferred: { - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/context_LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/localized`, + "localhost", + )}/odata/v2/main/context_LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')/localized`, }, }, __metadata: { type: "test.MainService.context_LocalizedEntity", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/context_LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, + "localhost", + )}/odata/v2/main/context_LocalizedEntity(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, }, }, }); - response = await util.callRead(request, `/odata/v2/main/context_LocalizedEntity(guid'${ id }')/texts`); + response = await util.callRead(request, `/odata/v2/main/context_LocalizedEntity(guid'${id}')/texts`); expect(response.body).toMatchObject({ d: { results: [ @@ -3773,10 +3819,10 @@ describe("main", () => { name: "Test-DE", __metadata: { type: "test.MainService.context_LocalizedEntity_texts", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/context_LocalizedEntity_texts(locale='en',ID=guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, + "localhost", + )}/odata/v2/main/context_LocalizedEntity_texts(locale='en',ID=guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, }, }, ], @@ -3784,7 +3830,7 @@ describe("main", () => { }); response = await util.callRead( request, - "/odata/v2/main/context_LocalizedEntity_texts(locale='en',ID=guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')" + "/odata/v2/main/context_LocalizedEntity_texts(locale='en',ID=guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')", ); expect(response.body).toMatchObject({ d: { @@ -3793,10 +3839,10 @@ describe("main", () => { name: "Test-DE", __metadata: { type: "test.MainService.context_LocalizedEntity_texts", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/context_LocalizedEntity_texts(locale='en',ID=guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, + "localhost", + )}/odata/v2/main/context_LocalizedEntity_texts(locale='en',ID=guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, }, }, }); @@ -3848,10 +3894,10 @@ describe("main", () => { stock: 5, __metadata: { type: "test.MainService.Book", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/Book(author='Catweazle',genre_ID=1)`, + "localhost", + )}/odata/v2/main/Book(author='Catweazle',genre_ID=1)`, }, }); response = await util.callWrite(request, `/odata/v2/main/Book_order2?author='Catweazle'&genre_ID=1&number=5`); @@ -3861,10 +3907,10 @@ describe("main", () => { stock: 5, __metadata: { type: "test.MainService.Book", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/Book(author='Catweazle%7CCatweazle',genre_ID=1)`, + "localhost", + )}/odata/v2/main/Book(author='Catweazle%7CCatweazle',genre_ID=1)`, }, }); }); @@ -3877,10 +3923,10 @@ describe("main", () => { stock: 5, __metadata: { type: "test.MainService.Book", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/Book(author='Cat%20weazle',genre_ID=1)`, + "localhost", + )}/odata/v2/main/Book(author='Cat%20weazle',genre_ID=1)`, }, }); }); @@ -3905,17 +3951,17 @@ describe("main", () => { { quantity: 1, startDate: "/Date(1681819200000+0000)/", - endDate: "/Date(1681819200000+0000)/" - } + endDate: "/Date(1681819200000+0000)/", + }, ], __metadata: { type: "test.MainService.HeaderStructure", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderStructure(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')` - } - } + "localhost", + )}/odata/v2/main/HeaderStructure(guid'36a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, + }, + }, ]); }); @@ -3937,42 +3983,43 @@ describe("main", () => { { quantity: 2, startDate: "/Date(1681819200000)/", - endDate: "/Date(1681819200000)/" - } - ] + endDate: "/Date(1681819200000)/", + }, + ], }); expect(response.statusCode).toEqual(201); - response = await util.callRead(request, `/odata/v2/main/HeaderStructure(guid'26a0b287-eae5-46f7-80a8-f3eb2f9bb328')`); - expect(response.body.d).toMatchObject( - { - ID: "26a0b287-eae5-46f7-80a8-f3eb2f9bb328", - date: "/Date(1681819200000+0000)/", - // cds.odata.structs: false - step_quantity: 2, - step_startDate: "/Date(1681819200000+0000)/", - step_endDate: "/Date(1681819200000+0000)/", - // cds.odata.structs: true - /*step: { + response = await util.callRead( + request, + `/odata/v2/main/HeaderStructure(guid'26a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, + ); + expect(response.body.d).toMatchObject({ + ID: "26a0b287-eae5-46f7-80a8-f3eb2f9bb328", + date: "/Date(1681819200000+0000)/", + // cds.odata.structs: false + step_quantity: 2, + step_startDate: "/Date(1681819200000+0000)/", + step_endDate: "/Date(1681819200000+0000)/", + // cds.odata.structs: true + /*step: { quantity: 2, startDate: "/Date(1681819200000+0000)/", endDate: "/Date(1681819200000+0000)/" },*/ - phases: [ - { - quantity: 2, - startDate: "/Date(1681819200000+0000)/", - endDate: "/Date(1681819200000+0000)/" - } - ], - __metadata: { - type: "test.MainService.HeaderStructure", - uri: `http://${ response.request.host.replace( - "127.0.0.1", - "localhost" - ) }/odata/v2/main/HeaderStructure(guid'26a0b287-eae5-46f7-80a8-f3eb2f9bb328')` - } - } - ); + phases: [ + { + quantity: 2, + startDate: "/Date(1681819200000+0000)/", + endDate: "/Date(1681819200000+0000)/", + }, + ], + __metadata: { + type: "test.MainService.HeaderStructure", + uri: `http://${response.request.host.replace( + "127.0.0.1", + "localhost", + )}/odata/v2/main/HeaderStructure(guid'26a0b287-eae5-46f7-80a8-f3eb2f9bb328')`, + }, + }); }); it("Entity with managed compositions", async () => { @@ -3988,11 +4035,11 @@ describe("main", () => { quantity: 11, __metadata: { type: "test.MainService.Orders_Items", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/Orders_Items(up__ID=1,pos=1)` - } + "localhost", + )}/odata/v2/main/Orders_Items(up__ID=1,pos=1)`, + }, }, { up__ID: 1, @@ -4001,36 +4048,30 @@ describe("main", () => { quantity: 12, __metadata: { type: "test.MainService.Orders_Items", - uri: `http://${ response.request.host.replace( + uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - ) }/odata/v2/main/Orders_Items(up__ID=1,pos=2)` - } - } - ] + "localhost", + )}/odata/v2/main/Orders_Items(up__ID=1,pos=2)`, + }, + }, + ], }, __metadata: { type: "test.MainService.Orders", - uri: `http://${ response.request.host.replace( - "127.0.0.1", - "localhost" - ) }/odata/v2/main/Orders(1)` - } + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Orders(1)`, + }, }); }); - it("GET entity with special characters in entity name ", async () => { + it("GET entity with special characters in entity name", async () => { let response = await util.callRead(request, `/odata/v2/main/Funcionários(1)`); expect(response.body.d).toMatchObject({ ID: 1, name: "Toast", __metadata: { type: "test.MainService.Funcionários", - uri: `http://${ response.request.host.replace( - "127.0.0.1", - "localhost" - ) }/odata/v2/main/Funcionários(1)` - } + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Funcionários(1)`, + }, }); response = await util.callRead(request, `/odata/v2/main/Funcion%C3%A1rios(1)`); expect(response.body.d).toMatchObject({ @@ -4038,11 +4079,8 @@ describe("main", () => { name: "Toast", __metadata: { type: "test.MainService.Funcionários", - uri: `http://${ response.request.host.replace( - "127.0.0.1", - "localhost" - ) }/odata/v2/main/Funcionários(1)` - } + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/main/Funcionários(1)`, + }, }); }); @@ -4052,18 +4090,24 @@ describe("main", () => { }); expect(response.body).toBeDefined(); const id = response.body.d.ID; - response = await util.callWrite(request, `/odata/v2/main/User_Pay?ID=guid'${ id }'&cost=5454m`); + response = await util.callWrite(request, `/odata/v2/main/User_Pay?ID=guid'${id}'&cost=5454m`); expect(response.statusCode).toEqual(204); response = await util.callWrite(request, `/odata/v2/main/User_Pay?cost=5454m`); expect(response.statusCode).toEqual(400); }); it("Header 'odata-version' is removed", async () => { - let response = await util.callWrite(request, "/odata/v2/main/Header", { - name: "Test", - }, false,{ - "odata-version": "2.0" - }); + let response = await util.callWrite( + request, + "/odata/v2/main/Header", + { + name: "Test", + }, + false, + { + "odata-version": "2.0", + }, + ); expect(response.statusCode).toEqual(201); expect(response.body).toBeDefined(); const id = response.body.d.ID; diff --git a/test/mtx/mtx-local.test.js b/test/mtx/mtx-local.test.js index c4a9abf5..15845d90 100644 --- a/test/mtx/mtx-local.test.js +++ b/test/mtx/mtx-local.test.js @@ -19,12 +19,12 @@ const csn = { kind: "entity", elements: { ID: { - type: "cds.UUID" + type: "cds.UUID", }, name: { - type: "cds.String" - } - } + type: "cds.String", + }, + }, }, }, }; @@ -42,7 +42,7 @@ const edmx = ` `; const authorization = `Basic ${Buffer.from( - `${cds.requires.auth.users.alice.id}:${cds.requires.auth.users.alice.password}` + `${cds.requires.auth.users.alice.id}:${cds.requires.auth.users.alice.password}`, ).toString("base64")}`; let errorExtended = false; @@ -113,7 +113,7 @@ describe("mtx", () => { expect(consoleSpy).toHaveBeenCalledWith( "[cov2ap] -", "MetadataRequest:", - expect.objectContaining(new Error("MTX isExtended Error")) + expect.objectContaining(new Error("MTX isExtended Error")), ); consoleSpy.mockClear(); @@ -129,7 +129,7 @@ describe("mtx", () => { expect(consoleSpy).toHaveBeenCalledWith( "[cov2ap] -", "MetadataRequest:", - expect.objectContaining(new Error("MTX getCsn Error")) + expect.objectContaining(new Error("MTX getCsn Error")), ); consoleSpy.mockClear(); @@ -145,7 +145,7 @@ describe("mtx", () => { expect(consoleSpy).toHaveBeenCalledWith( "[cov2ap] -", "MetadataRequest:", - expect.objectContaining(new Error("MTX getEdmx Error")) + expect.objectContaining(new Error("MTX getEdmx Error")), ); consoleSpy.mockClear(); diff --git a/test/mtx/mtx-remote.test.js b/test/mtx/mtx-remote.test.js index f8e333c3..92ab9b0e 100644 --- a/test/mtx/mtx-remote.test.js +++ b/test/mtx/mtx-remote.test.js @@ -30,7 +30,7 @@ const edmx = ` `; const authorization = `Basic ${Buffer.from( - `${cds.requires.auth.users.alice.id}:${cds.requires.auth.users.alice.password}` + `${cds.requires.auth.users.alice.id}:${cds.requires.auth.users.alice.password}`, ).toString("base64")}`; describe("mtx", () => { diff --git a/test/mtx/mtxs.test.js b/test/mtx/mtxs.test.js index 64287ccd..34572980 100644 --- a/test/mtx/mtxs.test.js +++ b/test/mtx/mtxs.test.js @@ -18,12 +18,12 @@ const csn = { kind: "entity", elements: { ID: { - type: "cds.UUID" + type: "cds.UUID", }, name: { - type: "cds.String" - } - } + type: "cds.String", + }, + }, }, }, }; @@ -41,7 +41,7 @@ const edmx = ` `; const authorization = `Basic ${Buffer.from( - `${cds.requires.auth.users.alice.id}:${cds.requires.auth.users.alice.password}` + `${cds.requires.auth.users.alice.id}:${cds.requires.auth.users.alice.password}`, ).toString("base64")}`; function clearCache() { diff --git a/test/passenger.test.js b/test/passenger.test.js index 934acc26..dcdfdf34 100644 --- a/test/passenger.test.js +++ b/test/passenger.test.js @@ -21,7 +21,7 @@ describe("passenger", () => { "/odata/v2/passenger-transportation/CalculationFactors(TRANSPORT_MODE_KEY='Company_Car',DIMENSION='DEFAULT',CLASS='DEFAULT',COUNTRY_OF_TRIP='DEFAULT',CURRENCY='DEFAULT',ALLOCATION_METHOD='KM',VALID_FROM='2000-01-02',VALID_TO='4000-01-02')", { accept: "application/json", - } + }, ); expect(response.body).toBeDefined(); expect(response.body).toEqual({ @@ -38,7 +38,7 @@ describe("passenger", () => { type: "passenger.PassengerTransportationService.CalculationFactors", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" + "localhost", )}/odata/v2/passenger-transportation/CalculationFactors(TRANSPORT_MODE_KEY='Company_Car',DIMENSION='DEFAULT',CLASS='DEFAULT',COUNTRY_OF_TRIP='DEFAULT',CURRENCY='DEFAULT',ALLOCATION_METHOD='KM',VALID_FROM='2000-01-02',VALID_TO='4000-01-02')`, }, }, diff --git a/test/protocols.test.js b/test/protocols.test.js index 31c37ba7..94341811 100644 --- a/test/protocols.test.js +++ b/test/protocols.test.js @@ -74,29 +74,38 @@ describe("CDS protocols", () => { it("service annotated with @odata", async () => expectGET(request, "/odata/v2/atodata")); - it("reject service annotated with @rest", async () => expectRejectProtocol(request, '/odata/v2/rest/atrest')); + it("reject service annotated with @rest", async () => expectRejectProtocol(request, "/odata/v2/rest/atrest")); - it("service annotated with @protocol: 'odata'", async () => expectGET(request, '/odata/v2/atprotocolodata')); + it("service annotated with @protocol: 'odata'", async () => expectGET(request, "/odata/v2/atprotocolodata")); - it("service annotated with @protocol: 'rest'", async () => expectRejectProtocol(request, '/odata/v2/rest/atprotocolrest')); + it("service annotated with @protocol: 'rest'", async () => + expectRejectProtocol(request, "/odata/v2/rest/atprotocolrest")); - it("service annotated with @protocol: ['odata']", async () => expectGET(request, '/odata/v2/atprotocollistodata')); + it("service annotated with @protocol: ['odata']", async () => expectGET(request, "/odata/v2/atprotocollistodata")); - it("service annotated with @protocol: ['rest']", async () => expectRejectProtocol(request, '/odata/v2/rest/atprotocollistrest')); + it("service annotated with @protocol: ['rest']", async () => + expectRejectProtocol(request, "/odata/v2/rest/atprotocollistrest")); - it("service annotated with @protocol: [{ kind: 'odata', path: 'relative2' }]", async () => expectGET(request, '/odata/v2/relative2')); + it("service annotated with @protocol: [{ kind: 'odata', path: 'relative2' }]", async () => + expectGET(request, "/odata/v2/relative2")); - it("service annotated with @protocol: [{ kind: 'odata', path: '/absolute2' }]", async () => expectGET(request, '/odata/v2/absolute2')); + it("service annotated with @protocol: [{ kind: 'odata', path: '/absolute2' }]", async () => + expectGET(request, "/odata/v2/absolute2")); - it("service annotated with @protocol: [{ kind: 'odata', path: '/custom/odata/path' }]", async () => expectGET(request, '/odata/v2/custom/odata/path')); + it("service annotated with @protocol: [{ kind: 'odata', path: '/custom/odata/path' }]", async () => + expectGET(request, "/odata/v2/custom/odata/path")); - it("service annotated with @protocol: [{ kind: 'odata-v4', path: '/custom2/odata/path' }]", async () => expectGET(request, '/odata/v2/custom2/odata/path')); + it("service annotated with @protocol: [{ kind: 'odata-v4', path: '/custom2/odata/path' }]", async () => + expectGET(request, "/odata/v2/custom2/odata/path")); - it("service annotated with @protocol: [{ kind: 'odata-v4', path: '/odata' }]", async () => expectGET(request, '/odata/v2/odata')); + it("service annotated with @protocol: [{ kind: 'odata-v4', path: '/odata' }]", async () => + expectGET(request, "/odata/v2/odata")); - it("service annotated with @protocol: [{ kind: 'odata-v4', path: 'odata' }]", async () => expectGET(request, '/odata/v2/odata')); + it("service annotated with @protocol: [{ kind: 'odata-v4', path: 'odata' }]", async () => + expectGET(request, "/odata/v2/odata")); - it("service annotated with @protocol: [{ kind: 'odata-v4', path: '/odata/v4/odata' }]", async () => expectGET(request, '/odata/v2/odata')); + it("service annotated with @protocol: [{ kind: 'odata-v4', path: '/odata/v4/odata' }]", async () => + expectGET(request, "/odata/v2/odata")); it("service with absolute path on batch calls", async () => { let response = await util.callRead(request, "/odata/v2/absolute/Header?$top=1"); @@ -120,4 +129,4 @@ describe("CDS protocols", () => { expect(third.body.d.ID).toEqual(ID); expect(third.contentTransferEncoding).toEqual("binary"); }); -}); \ No newline at end of file +}); diff --git a/test/task-provider.test.js b/test/task-provider.test.js index 7aec3bf8..1aeac351 100644 --- a/test/task-provider.test.js +++ b/test/task-provider.test.js @@ -44,10 +44,12 @@ describe("task-provider", () => { }); expect(response.body).toBeDefined(); expect(response.body.d.results.length > 0).toEqual(true); - expect(response.body.d.results[0].urn).toEqual("urn:sap.odm.bpm.task:4711:task-approval$ea99df92-6225-4d75-bbd0-9b11f73c7f60"); + expect(response.body.d.results[0].urn).toEqual( + "urn:sap.odm.bpm.task:4711:task-approval$ea99df92-6225-4d75-bbd0-9b11f73c7f60", + ); expect(response.body.d.results[0].__metadata).toEqual({ type: "test.TaskProviderService.tasks", - uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/task-provider/tasks('urn:sap.odm.bpm.task:4711:task-approval%24ea99df92-6225-4d75-bbd0-9b11f73c7f60')` + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/task-provider/tasks('urn:sap.odm.bpm.task:4711:task-approval%24ea99df92-6225-4d75-bbd0-9b11f73c7f60')`, }); }); @@ -69,11 +71,12 @@ describe("task-provider", () => { }); expect(response.body).toBeDefined(); expect(response.body.d.results.length > 0).toEqual(true); - expect(response.body.d.results[0].urn).toEqual("urn:sap.odm.bpm.task:4711:task-approval$ea99df92-6225-4d75-bbd0-9b11f73c7f60"); + expect(response.body.d.results[0].urn).toEqual( + "urn:sap.odm.bpm.task:4711:task-approval$ea99df92-6225-4d75-bbd0-9b11f73c7f60", + ); expect(response.body.d.results[0].__metadata).toEqual({ type: "test.TaskProviderService.tasks", - uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/task-provider/v2/tasks('urn:sap.odm.bpm.task:4711:task-approval%24ea99df92-6225-4d75-bbd0-9b11f73c7f60')` + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/task-provider/v2/tasks('urn:sap.odm.bpm.task:4711:task-approval%24ea99df92-6225-4d75-bbd0-9b11f73c7f60')`, }); }); - }); diff --git a/test/todo.test.js b/test/todo.test.js index 3069b1a2..95722ce4 100644 --- a/test/todo.test.js +++ b/test/todo.test.js @@ -22,8 +22,8 @@ describe("todo", () => { request, "/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d).toMatchObject({ @@ -37,25 +37,25 @@ describe("todo", () => { keyTimeEdit: "PT12H34M56S", tentative: true, task: { - __deferred: {} + __deferred: {}, }, person: { - __deferred: {} + __deferred: {}, }, __metadata: { type: "todo.TodoService.PlannedTasks", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')` - } + "localhost", + )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')`, + }, }); response = await util.callRead( request, "/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetime'2019-08-23T00:00:00Z',endDate=datetime'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d).toMatchObject({ @@ -69,25 +69,25 @@ describe("todo", () => { keyTimeEdit: "PT12H34M56S", tentative: true, task: { - __deferred: {} + __deferred: {}, }, person: { - __deferred: {} + __deferred: {}, }, __metadata: { type: "todo.TodoService.PlannedTasks", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')` - } + "localhost", + )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')`, + }, }); response = await util.callRead( request, "/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00%3A00%3A00Z',endDate=datetimeoffset'2019-08-23T00%3A00%3A00Z',keyDate=datetime'2019-12-31T00%3A00%3A00',keyTime=time'PT12H34M56S')", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d).toMatchObject({ @@ -101,14 +101,14 @@ describe("todo", () => { keyTimeEdit: "PT12H34M56S", tentative: true, task: { - __deferred: {} + __deferred: {}, }, person: { - __deferred: {} + __deferred: {}, }, __metadata: { - type: "todo.TodoService.PlannedTasks" - } + type: "todo.TodoService.PlannedTasks", + }, }); }); @@ -132,14 +132,14 @@ describe("todo", () => { keyTimeEdit: "PT12H34M56S", tentative: true, task: { - __deferred: {} + __deferred: {}, }, person: { - __deferred: {} + __deferred: {}, }, __metadata: { - type: "todo.TodoService.PlannedTasks" - } + type: "todo.TodoService.PlannedTasks", + }, }); expect(third.body.d).toMatchObject({ task_ID: 1, @@ -152,20 +152,20 @@ describe("todo", () => { keyTimeEdit: "PT12H34M56S", tentative: true, task: { - __deferred: {} + __deferred: {}, }, person: { - __deferred: {} + __deferred: {}, }, __metadata: { - type: "todo.TodoService.PlannedTasks" - } + type: "todo.TodoService.PlannedTasks", + }, }); }); it("CRUD test", async () => { let response = await util.callRead(request, "/odata/v2/todo/People?$expand=plannedTasks", { - accept: "application/json" + accept: "application/json", }); expect(response.body).toBeDefined(); expect(response.body.d.results).toMatchObject([ @@ -173,7 +173,7 @@ describe("todo", () => { ID: 1, __metadata: { type: "todo.TodoService.People", - uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/todo/People(1)` + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/todo/People(1)`, }, name: "Joe", birthDate: "1990-07-01", @@ -185,17 +185,17 @@ describe("todo", () => { type: "todo.TodoService.PlannedTasks", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')` + "localhost", + )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')`, }, endDate: "2019-08-23T00:00:00Z", person: { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/person` - } + "localhost", + )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/person`, + }, }, person_ID: 1, startDate: "2019-08-23T00:00:00Z", @@ -203,34 +203,34 @@ describe("todo", () => { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/task` - } + "localhost", + )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/task`, + }, }, task_ID: 1, - tentative: true - } - ] - } + tentative: true, + }, + ], + }, }, { ID: 2, __metadata: { type: "todo.TodoService.People", - uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/todo/People(2)` + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/todo/People(2)`, }, name: "Jane", birthDate: "1981-08-14", birthTime: "08:15:18", plannedTasks: { - results: [] - } + results: [], + }, }, { ID: 3, __metadata: { type: "todo.TodoService.People", - uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/todo/People(3)` + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/todo/People(3)`, }, name: "Bob", birthDate: "1978-01-05", @@ -242,17 +242,17 @@ describe("todo", () => { type: "todo.TodoService.PlannedTasks", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/todo/PlannedTasks(task_ID=2,person_ID=3,startDate=datetimeoffset'2019-08-24T00:00:00Z',endDate=datetimeoffset'2019-08-24T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')` + "localhost", + )}/odata/v2/todo/PlannedTasks(task_ID=2,person_ID=3,startDate=datetimeoffset'2019-08-24T00:00:00Z',endDate=datetimeoffset'2019-08-24T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')`, }, endDate: "2019-08-24T00:00:00Z", person: { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/todo/PlannedTasks(task_ID=2,person_ID=3,startDate=datetimeoffset'2019-08-24T00:00:00Z',endDate=datetimeoffset'2019-08-24T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/person` - } + "localhost", + )}/odata/v2/todo/PlannedTasks(task_ID=2,person_ID=3,startDate=datetimeoffset'2019-08-24T00:00:00Z',endDate=datetimeoffset'2019-08-24T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/person`, + }, }, person_ID: 3, startDate: "2019-08-24T00:00:00Z", @@ -260,27 +260,27 @@ describe("todo", () => { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/todo/PlannedTasks(task_ID=2,person_ID=3,startDate=datetimeoffset'2019-08-24T00:00:00Z',endDate=datetimeoffset'2019-08-24T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/task` - } + "localhost", + )}/odata/v2/todo/PlannedTasks(task_ID=2,person_ID=3,startDate=datetimeoffset'2019-08-24T00:00:00Z',endDate=datetimeoffset'2019-08-24T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/task`, + }, }, task_ID: 2, - tentative: false - } - ] - } - } + tentative: false, + }, + ], + }, + }, ]); const todo = response.body.d.results[0]; response = await util.callRead(request, "/odata/v2/todo/People(1)", { - accept: "application/json" + accept: "application/json", }); expect(response.body.d).toBeDefined(); expect(response.body.d.ID).toEqual(1); let plannedTaskUri = todo.plannedTasks.results[0].__metadata.uri; plannedTaskUri = plannedTaskUri.substr(`http://${response.request.host.replace("127.0.0.1", "localhost")}`.length); response = await util.callRead(request, plannedTaskUri, { - accept: "application/json" + accept: "application/json", }); expect(response.body.d).toBeDefined(); expect(response.body.d).toEqual({ @@ -288,17 +288,17 @@ describe("todo", () => { type: "todo.TodoService.PlannedTasks", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')` + "localhost", + )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')`, }, endDate: "2019-08-23T00:00:00Z", person: { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/person` - } + "localhost", + )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/person`, + }, }, person_ID: 1, startDate: "2019-08-23T00:00:00Z", @@ -306,16 +306,16 @@ describe("todo", () => { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/task` - } + "localhost", + )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/task`, + }, }, keyDate: "/Date(1577750400000)/", keyTime: "PT12H34M56S", keyDateEdit: "/Date(1577750400000)/", keyTimeEdit: "PT12H34M56S", task_ID: 1, - tentative: true + tentative: true, }); response = await util.callWrite( request, @@ -323,16 +323,16 @@ describe("todo", () => { { tentative: false, keyDateEdit: "/Date(1577836800000)/", - keyTimeEdit: "P00DT13H35M57S" + keyTimeEdit: "P00DT13H35M57S", }, true, { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.statusCode).toEqual(200); response = await util.callRead(request, plannedTaskUri, { - accept: "application/json" + accept: "application/json", }); expect(response.body.d).toBeDefined(); expect(response.body.d).toEqual({ @@ -340,17 +340,17 @@ describe("todo", () => { type: "todo.TodoService.PlannedTasks", uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')` + "localhost", + )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')`, }, endDate: "2019-08-23T00:00:00Z", person: { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/person` - } + "localhost", + )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/person`, + }, }, person_ID: 1, startDate: "2019-08-23T00:00:00Z", @@ -358,37 +358,37 @@ describe("todo", () => { __deferred: { uri: `http://${response.request.host.replace( "127.0.0.1", - "localhost" - )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/task` - } + "localhost", + )}/odata/v2/todo/PlannedTasks(task_ID=1,person_ID=1,startDate=datetimeoffset'2019-08-23T00:00:00Z',endDate=datetimeoffset'2019-08-23T00:00:00Z',keyDate=datetime'2019-12-31T00:00:00',keyTime=time'PT12H34M56S')/task`, + }, }, keyDate: "/Date(1577750400000)/", keyTime: "PT12H34M56S", keyDateEdit: "/Date(1577836800000)/", keyTimeEdit: "PT13H35M57S", task_ID: 1, - tentative: false + tentative: false, }); response = await util.callDelete(request, plannedTaskUri); expect(response.statusCode).toEqual(204); response = await util.callRead(request, plannedTaskUri, { - accept: "application/json" + accept: "application/json", }); expect(response.statusCode).toEqual(404); response = await util.callRead(request, "/odata/v2/todo/People(1)?$expand=plannedTasks", { - accept: "application/json" + accept: "application/json", }); expect(response.body).toBeDefined(); expect(response.body.d).toMatchObject({ ID: 1, __metadata: { type: "todo.TodoService.People", - uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/todo/People(1)` + uri: `http://${response.request.host.replace("127.0.0.1", "localhost")}/odata/v2/todo/People(1)`, }, name: "Joe", plannedTasks: { - results: [] - } + results: [], + }, }); }); @@ -397,8 +397,8 @@ describe("todo", () => { request, "/odata/v2/todo/Tasks?$filter=uuid eq guid'05db01e5-28e6-4668-9fdb-7da666c2eec8' or title eq 'ABC' or value1 ge 5.5d", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); @@ -406,8 +406,8 @@ describe("todo", () => { request, "/odata/v2/todo/Tasks?$filter=value1 eq 0.9d or title eq 'ABC' or value1 ge 5.5d", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); @@ -415,8 +415,8 @@ describe("todo", () => { request, "/odata/v2/todo/Tasks?$filter=title eq 'ABC' or value1 ge 5.5d or value2 eq 1.1m", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); @@ -424,22 +424,26 @@ describe("todo", () => { request, "/odata/v2/todo/Tasks?$filter=value3 eq 1.2f or title eq 'ABC' or value1 ge 5.5d", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); - response = await util.callRead(request, "/odata/v2/todo/Tasks?$filter=value4 eq 3L or title eq 'ABC' or value1 ge 5.5d", { - accept: "application/json" - }); + response = await util.callRead( + request, + "/odata/v2/todo/Tasks?$filter=value4 eq 3L or title eq 'ABC' or value1 ge 5.5d", + { + accept: "application/json", + }, + ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); response = await util.callRead( request, "/odata/v2/todo/People(3)/plannedTasks?$filter=startDate eq datetimeoffset'2019-08-24T00:00:00Z'", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); @@ -447,8 +451,8 @@ describe("todo", () => { request, "/odata/v2/todo/People(3)/plannedTasks?$filter=startDate le datetimeoffset'2019-08-24T00:00:00Z' or startDate ge datetimeoffset'2019-08-24T00:00:00Z'", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); @@ -456,8 +460,8 @@ describe("todo", () => { request, "/odata/v2/todo/People(3)/plannedTasks?$filter=keyDate eq datetime'2019-12-31T00:00:00' or tentative eq true", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); @@ -465,8 +469,8 @@ describe("todo", () => { request, "/odata/v2/todo/People(3)/plannedTasks?$filter=keyDate le datetime'2019-12-31T00:00:00' or keyDate ge datetime'2019-12-31T00:00:00' or tentative eq true", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); @@ -474,8 +478,8 @@ describe("todo", () => { request, "/odata/v2/todo/People(3)/plannedTasks?$filter=keyDate le datetime'2019-12-31T00:00Z' or keyDate ge datetime'2019-12-31T00:00Z' or tentative eq true", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); @@ -483,8 +487,8 @@ describe("todo", () => { request, "/odata/v2/todo/People(3)/plannedTasks?$filter=tentative eq true or keyTime eq time'PT12H34M56S'", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); @@ -492,13 +496,13 @@ describe("todo", () => { request, "/odata/v2/todo/People(3)/plannedTasks?$filter=tentative eq true or day(keyDate) eq 31", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); response = await util.callRead(request, "/odata/v2/todo/Tasks?$filter=round(value1) eq 1d", { - accept: "application/json" + accept: "application/json", }); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); @@ -509,8 +513,8 @@ describe("todo", () => { request, "/odata/v2/todo/Tasks?$filter=uuid eq guid'05db01e5-28e6-4668-9fdb-7da666c2eec8' or uuid eq guid'775863cf-9bf2-42a3-ac07-caf67a0b7955'", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(2); @@ -518,8 +522,8 @@ describe("todo", () => { request, "/odata/v2/todo/Tasks?$filter=uuid eq guid'05db01e5-28e6-4668-9fdb-7da666c2eec8' and title eq 'guid''05db01e5-28e6-4668-9fdb-7da666c2eec8'''", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(0); @@ -527,13 +531,13 @@ describe("todo", () => { request, "/odata/v2/todo/Tasks?$filter=((value4 eq 3L or title eq 'ABC' or value1 ge 5.5d or uuid eq guid'05db01e5-28e6-4668-9fdb-7da666c2eec8') and (title eq 'guid''05db01e5-28e6-4668-9fdb-7da666c2eec8''''' or uuid eq guid'05db01e5-28e6-4668-9fdb-7da666c2eec8' or value2 ge 5.5m))", { - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(1); response = await util.callRead(request, "/odata/v2/todo/Tasks?$filter='''ABC''''' ne title or value4 eq 3L", { - accept: "application/json" + accept: "application/json", }); expect(response.body).toBeDefined(); expect(response.body.d.results.length).toEqual(2); @@ -541,7 +545,7 @@ describe("todo", () => { it("tests IEEE754Compatible on decimals", async () => { let response = await util.callRead(request, "/odata/v2/todo/Tasks(1)", { - accept: "application/json" + accept: "application/json", }); expect(response.body.d).toBeDefined(); expect(response.body.d.ID).toEqual(1); @@ -551,17 +555,17 @@ describe("todo", () => { request, "/odata/v2/todo/Tasks(1)", { - value2: "1.61" + value2: "1.61", }, true, { "content-type": "application/json", - accept: "application/json" - } + accept: "application/json", + }, ); expect(response.statusCode).toEqual(200); response = await util.callRead(request, "/odata/v2/todo/Tasks(1)", { - accept: "application/json" + accept: "application/json", }); expect(response.body.d).toBeDefined(); expect(response.body.d.ID).toEqual(1); @@ -572,7 +576,7 @@ describe("todo", () => { response = await util.callMultipart(request, "/odata/v2/todo/$batch", payload); expect(response.statusCode).toEqual(202); response = await util.callRead(request, "/odata/v2/todo/Tasks(1)", { - accept: "application/json" + accept: "application/json", }); expect(response.body.d).toBeDefined(); expect(response.body.d.ID).toEqual(1); @@ -589,13 +593,13 @@ describe("todo", () => { keyTime: "PT12H34M56S", keyDateEdit: "/Date(1577750400000)/", keyTimeEdit: "PT12H34M56S", - tentative: true + tentative: true, }); expect(response.body).toBeDefined(); expect(response.body.d).toBeDefined(); response = await util.callWrite( request, - "/odata/v2/todo/PlannedTasks_boundAction?task_ID=1&person_ID=1&num=1&text=abc&startDate=datetimeoffset'2019-08-23T00:00:00Z'&endDate=datetimeoffset'2019-08-23T00:00:00Z'&keyDate=datetime'2019-12-31T00:00:00'&keyTime=time'PT12H34M56S'&startDate2=datetimeoffset'2019-08-23T00:00:00Z'&endDate2=datetimeoffset'2019-08-23T00:00:00Z'&keyDate2=datetime'2019-12-31T00:00:00'&keyTime2=time'PT12H34M56S'" + "/odata/v2/todo/PlannedTasks_boundAction?task_ID=1&person_ID=1&num=1&text=abc&startDate=datetimeoffset'2019-08-23T00:00:00Z'&endDate=datetimeoffset'2019-08-23T00:00:00Z'&keyDate=datetime'2019-12-31T00:00:00'&keyTime=time'PT12H34M56S'&startDate2=datetimeoffset'2019-08-23T00:00:00Z'&endDate2=datetimeoffset'2019-08-23T00:00:00Z'&keyDate2=datetime'2019-12-31T00:00:00'&keyTime2=time'PT12H34M56S'", ); expect(response.body).toMatchObject({ d: { @@ -604,12 +608,12 @@ describe("todo", () => { startDate: "2019-08-23T00:00:00Z", endDate: "2019-08-23T00:00:00Z", keyDate: "/Date(1577750400000)/", - keyTime: "PT12H34M56S" - } + keyTime: "PT12H34M56S", + }, }); response = await util.callRead( request, - "/odata/v2/todo/PlannedTasks_boundFunction?task_ID=1&person_ID=1&num=1&text=abc&startDate=datetimeoffset'2019-08-23T00:00:00Z'&endDate=datetimeoffset'2019-08-23T00:00:00Z'&keyDate=datetime'2019-12-31T00:00:00'&keyTime=time'PT12H34M56S'&startDate2=datetimeoffset'2019-08-23T00:00:00Z'&endDate2=datetimeoffset'2019-08-23T00:00:00Z'&keyDate2=datetime'2019-12-31T00:00:00'&keyTime2=time'PT12H34M56S'" + "/odata/v2/todo/PlannedTasks_boundFunction?task_ID=1&person_ID=1&num=1&text=abc&startDate=datetimeoffset'2019-08-23T00:00:00Z'&endDate=datetimeoffset'2019-08-23T00:00:00Z'&keyDate=datetime'2019-12-31T00:00:00'&keyTime=time'PT12H34M56S'&startDate2=datetimeoffset'2019-08-23T00:00:00Z'&endDate2=datetimeoffset'2019-08-23T00:00:00Z'&keyDate2=datetime'2019-12-31T00:00:00'&keyTime2=time'PT12H34M56S'", ); expect(response.body).toMatchObject({ d: { @@ -620,7 +624,7 @@ describe("todo", () => { startDate: "2019-08-23T00:00:00Z", endDate: "2019-08-23T00:00:00Z", keyDate: "2019-12-31", - keyTime: "12:34:56" + keyTime: "12:34:56", }, data: { num: 1, @@ -628,10 +632,10 @@ describe("todo", () => { startDate2: "2019-08-23T00:00:00Z", endDate2: "2019-08-23T00:00:00Z", keyDate2: "2019-12-31", - keyTime2: "12:34:56" - } - }) - } + keyTime2: "12:34:56", + }, + }), + }, }); }); @@ -645,13 +649,13 @@ describe("todo", () => { keyTime: "PT12H34M56S", keyDateEdit: "/Date(1577750400000)/", keyTimeEdit: "PT12H34M56S", - tentative: true + tentative: true, }); expect(response.body).toBeDefined(); expect(response.body.d).toBeDefined(); response = await util.callWrite( request, - "/odata/v2/todo/unboundAction?num=1&text=abc&&startDate2=datetimeoffset'2019-08-23T00:00:00Z'&endDate2=datetimeoffset'2019-08-23T00:00:00Z'&keyDate2=datetime'2019-12-31T00:00:00'&keyTime2=time'PT12H34M56S'" + "/odata/v2/todo/unboundAction?num=1&text=abc&&startDate2=datetimeoffset'2019-08-23T00:00:00Z'&endDate2=datetimeoffset'2019-08-23T00:00:00Z'&keyDate2=datetime'2019-12-31T00:00:00'&keyTime2=time'PT12H34M56S'", ); expect(response.body).toMatchObject({ d: { @@ -660,12 +664,12 @@ describe("todo", () => { startDate: "2019-08-23T00:00:00Z", endDate: "2019-08-23T00:00:00Z", keyDate: "/Date(1577750400000)/", - keyTime: "PT12H34M56S" - } + keyTime: "PT12H34M56S", + }, }); response = await util.callRead( request, - "/odata/v2/todo/unboundFunction?num=1&text=abc&&startDate2=datetimeoffset'2019-08-23T00:00:00Z'&endDate2=datetimeoffset'2019-08-23T00:00:00Z'&keyDate2=datetime'2019-12-31T00:00:00'&keyTime2=time'PT12H34M56S'" + "/odata/v2/todo/unboundFunction?num=1&text=abc&&startDate2=datetimeoffset'2019-08-23T00:00:00Z'&endDate2=datetimeoffset'2019-08-23T00:00:00Z'&keyDate2=datetime'2019-12-31T00:00:00'&keyTime2=time'PT12H34M56S'", ); expect(response.body).toMatchObject({ d: { @@ -677,10 +681,10 @@ describe("todo", () => { startDate2: "2019-08-23T00:00:00Z", endDate2: "2019-08-23T00:00:00Z", keyDate2: "2019-12-31", - keyTime2: "12:34:56" - } - }) - } + keyTime2: "12:34:56", + }, + }), + }, }); }); @@ -703,7 +707,7 @@ describe("todo", () => { person_ID: 1, startDate: "2024-03-19T00:00:00Z", task_ID: 1, - tentative: true + tentative: true, }); }); @@ -726,7 +730,7 @@ describe("todo", () => { person_ID: 1, startDate: "2024-03-20T00:00:00Z", task_ID: 1, - tentative: true + tentative: true, }); }); });