-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DDFBRA-475 - Ensure that materials ready for loan display the correct "Lån før XX-XX-XXXX" date #1729
base: develop
Are you sure you want to change the base?
DDFBRA-475 - Ensure that materials ready for loan display the correct "Lån før XX-XX-XXXX" date #1729
Conversation
…XX-XXXX" date. 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have tests for this. If there are no test for this case I think we should make one.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This pull request addresses the issue of ensuring that E-materials ready for loan display the correct "Borrow before" date by updating both the presentation and test verification for digital reservations.
- Updated tests in the reservation list to verify the correct label for E-book reservations.
- Refactored the reservation material component to use the external digital product identifier instead of a separate identifier prop.
Reviewed Changes
File | Description |
---|---|
src/apps/reservation-list/list/reservation-list.test.ts | Added a test verifying that the E-book reservation is labeled correctly. |
src/apps/reservation-list/reservation-material/reservation-material.tsx | Replaced usage of the "identifier" prop with "material?.externalProductId" to correctly determine digital reservations. |
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
src/apps/reservation-list/reservation-material/reservation-material.tsx:28
- [nitpick] Confirm that the shift from using 'identifier' to 'material.externalProductId' is consistent across the component and its usage. Ensure that corresponding prop types and any dependent logic are updated accordingly.
const isDigital = !!material?.externalProductId;
src/apps/reservation-list/list/reservation-list.test.ts:510
- [nitpick] Consider adding additional tests for varying date values to confirm that reservation labels dynamically display the correct 'Borrow before' date under different scenarios.
"Borrow before 27-01-2023 20:37"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Link to issue
https://reload.atlassian.net/browse/DDFBRA-475
Description
This pull request ensures that E-materials that have been "reserved" and are now "ready for loan" display the correct label.
Please see the commit description for details on the problem and its solution.
Test
https://varnish.pr-2139.dpl-cms.dplplat01.dpl.reload.dk/
danskernesdigitalebibliotek/dpl-cms#2139
Note:
This state for the material is rare and difficult to reproduce, so I faked it like this inside:
src/core/utils/useReservations.tsx