From 53afae3cdcea85bd46322e7eeb24b1dfcfd4449f Mon Sep 17 00:00:00 2001 From: Kasper Birch Date: Thu, 14 Nov 2024 13:42:35 +0100 Subject: [PATCH] Fix `find-on-shelf` test after changing API from `/holdings/3` to `/holdingsLogistics/v1` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current test fixtures appear to be manually created. I’ve updated them to reflect the new structure, but I suggest refactoring this test in the future. Ideally, it should be tested directly from the material app instead of relying on this "artificial" environment. --- .../material/find-on-shelf-holdings.json | 93 +++++++++++++++---- .../find-on-shelf/find-on-shelf.test.ts | 24 +++-- 2 files changed, 89 insertions(+), 28 deletions(-) diff --git a/cypress/fixtures/material/find-on-shelf-holdings.json b/cypress/fixtures/material/find-on-shelf-holdings.json index acd289b1ac..d1278501c4 100644 --- a/cypress/fixtures/material/find-on-shelf-holdings.json +++ b/cypress/fixtures/material/find-on-shelf-holdings.json @@ -5,10 +5,20 @@ "reservations": 48, "holdings": [ { - "branch": { "branchId": "DK-775127", "title": "Tranbjerg" }, - "department": { "departmentId": "vo", "title": "Voksen" }, - "location": null, - "sublocation": null, + "branch": { + "branchId": "DK-775127", + "title": "Tranbjerg" + }, + "lmsPlacement": { + "location": null, + "sublocation": null, + "department": { + "departmentId": "vo", + "title": "Voksen" + }, + "section": null + }, + "logisticsPlacement": [], "materials": [ { "itemNumber": "5313131426", @@ -27,10 +37,20 @@ ] }, { - "branch": { "branchId": "DK-775127", "title": "Tranbjerg" }, - "department": { "departmentId": "vo", "title": "Voksen" }, - "location": null, - "sublocation": null, + "branch": { + "branchId": "DK-775127", + "title": "Tranbjerg" + }, + "lmsPlacement": { + "location": null, + "sublocation": null, + "department": { + "departmentId": "vo", + "title": "Voksen" + }, + "section": null + }, + "logisticsPlacement": [], "materials": [ { "itemNumber": "5313137426", @@ -49,10 +69,20 @@ ] }, { - "branch": { "branchId": "DK-775122", "title": "Beder-Malling" }, - "department": { "departmentId": "vo", "title": "Voksen" }, - "location": null, - "sublocation": null, + "branch": { + "branchId": "DK-775122", + "title": "Beder-Malling" + }, + "lmsPlacement": { + "location": null, + "sublocation": null, + "department": { + "departmentId": "vo", + "title": "Voksen" + }, + "section": null + }, + "logisticsPlacement": [], "materials": [ { "itemNumber": "5313131418", @@ -71,10 +101,20 @@ ] }, { - "branch": { "branchId": "DK-775100", "title": "Hovedbiblioteket" }, - "department": { "departmentId": "vo", "title": "Voksen" }, - "location": null, - "sublocation": null, + "branch": { + "branchId": "DK-775100", + "title": "Hovedbiblioteket" + }, + "lmsPlacement": { + "location": null, + "sublocation": null, + "department": { + "departmentId": "vo", + "title": "Voksen" + }, + "section": null + }, + "logisticsPlacement": [], "materials": [ { "itemNumber": "5258721529", @@ -93,10 +133,23 @@ ] }, { - "branch": { "branchId": "DK-775122", "title": "Beder-Malling" }, - "department": { "departmentId": "vo", "title": "Voksen" }, - "location": { "locationId": "læs", "title": "Læsesal" }, - "sublocation": null, + "branch": { + "branchId": "DK-775122", + "title": "Beder-Malling" + }, + "lmsPlacement": { + "location": { + "locationId": "læs", + "title": "Læsesal" + }, + "sublocation": null, + "department": { + "departmentId": "vo", + "title": "Voksen" + }, + "section": null + }, + "logisticsPlacement": [], "materials": [ { "itemNumber": "5313126015", diff --git a/src/components/find-on-shelf/find-on-shelf.test.ts b/src/components/find-on-shelf/find-on-shelf.test.ts index e3ec5bf05b..1cd6430103 100644 --- a/src/components/find-on-shelf/find-on-shelf.test.ts +++ b/src/components/find-on-shelf/find-on-shelf.test.ts @@ -3,10 +3,14 @@ describe("Find on shelf modal - default", () => { // Intercept holdings data call. cy.fixture("material/find-on-shelf-holdings.json") .then((result) => { - cy.intercept("GET", "**/external/agencyid/catalog/holdings/**", { - statusCode: 200, - body: result - }); + cy.intercept( + "GET", + "**/external/agencyid/catalog/holdingsLogistics/**", + { + statusCode: 200, + body: result + } + ); }) .as("Find on shelf holdings"); // Intercept availability data call. @@ -39,10 +43,14 @@ describe("Find on shelf modal - periodical", () => { // Intercept holdings data call. cy.fixture("material/find-on-shelf-holdings.json") .then((result) => { - cy.intercept("GET", "**/external/agencyid/catalog/holdings/**", { - statusCode: 200, - body: result - }); + cy.intercept( + "GET", + "**/external/agencyid/catalog/holdingsLogistics/**", + { + statusCode: 200, + body: result + } + ); }) .as("Find on shelf holdings"); // Intercept availability data call.