From 0a714bcf231994cdf642bfab1e5a62dec895edd1 Mon Sep 17 00:00:00 2001 From: Kasper Birch Date: Tue, 4 Mar 2025 15:30:24 +0100 Subject: [PATCH 1/2] =?UTF-8?q?Ensure=20that=20materials=20ready=20for=20l?= =?UTF-8?q?oan=20display=20the=20correct=20"L=C3=A5n=20f=C3=B8r=20XX-XX-XX?= =?UTF-8?q?XX"=20date.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I am not a big fan of the `fetchDigitalMaterial` and `fetchMaterial` higher-order components. They are too difficult to read. Maybe these should be rewritten in the future. However, from what I can see, there is never an `identifier` in the props. Therefore, the `isDigital` variable is never set to true. This causes `getInfo` inside `src/apps/reservation-list/reservation-material/reservation-info.tsx` to use `pickupDeadline` instead of `expiryDate`, which is the intended behavior for digital materials. --- .../reservation-material/reservation-material.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/apps/reservation-list/reservation-material/reservation-material.tsx b/src/apps/reservation-list/reservation-material/reservation-material.tsx index 2bcef5d8da..b148441a90 100644 --- a/src/apps/reservation-list/reservation-material/reservation-material.tsx +++ b/src/apps/reservation-list/reservation-material/reservation-material.tsx @@ -12,7 +12,6 @@ export interface ReservationMaterialProps { reservation: ReservationType; focused: boolean; openReservationDetailsModal: (reservation: ReservationType) => void; - identifier?: string | null; dataCy?: string; } @@ -21,13 +20,12 @@ const ReservationMaterial: FC = ({ reservation, focused, openReservationDetailsModal, - identifier, dataCy = "reservation-material" }) => { const openDetailsModal = () => { openReservationDetailsModal(reservation); }; - const isDigital = !!identifier; + const isDigital = !!material?.externalProductId; return (
  • From 75f7568d1a1bde6988d0a97b2ffdd94f21b2debf Mon Sep 17 00:00:00 2001 From: Kasper Birch Date: Wed, 5 Mar 2025 13:02:33 +0100 Subject: [PATCH 2/2] Add test for displaying E-book reservations "Ready for pickup" Adds a test to ensure that e-book reservations are properly displayed when they are "ready for pickup". Previously, no such test existed. The test was executed on the `develop` branch and failed as expected, confirming that the digital reservation element is not displayed correctly. --- .../list/reservation-list.test.ts | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/apps/reservation-list/list/reservation-list.test.ts b/src/apps/reservation-list/list/reservation-list.test.ts index 60b2f53707..1fb44f3858 100644 --- a/src/apps/reservation-list/list/reservation-list.test.ts +++ b/src/apps/reservation-list/list/reservation-list.test.ts @@ -479,6 +479,44 @@ describe("Reservation list", () => { .should("exist"); }); + it("should display the E-book reservation that is ready for pickup properly", () => { + cy.visit( + "/iframe.html?path=/story/apps-reservation-list--reservation-list-entry" + ); + cy.wait("@user"); + + cy.getBySel("reservation-material") + .eq(2) + .within(() => { + cy.get(".status-label.status-label--outline").should( + "have.text", + "E-book" + ); + + cy.get(".list-reservation__header__text").should( + "have.text", + "Mordet i det blĂ„ tog" + ); + + cy.getBySel("reservation-about-author").should( + "have.text", + "By Agatha Christie and Jutta Larsen (2014)" + ); + + cy.get(".counter__label").should("have.text", "Ready"); + + cy.getBySel("info-label").should( + "have.text", + "Borrow before 27-01-2023 20:37" + ); + + cy.get(".list-reservation__deadline .text-small-caption").should( + "have.text", + "Online access" + ); + }); + }); + it("Reservations list ready for pickup empty", () => { cy.intercept( "GET",