Bug 37707: (QA follow-up) Fix incorrect bold date expectations in Cypress test

- The test for circulation rules date calculations did not account for
  the start date being bold, only the period endpoint dates
- place_booking.js explicitly adds the selected start date to boldDates
  (boldDates = [new Date(startDate)]), giving it the "title" class
- The verification loop checking for unexpected bold dates then failed
  when it encountered the start date, which was bold but not expected
- Add clearZoneStart to expectedBoldDates to match actual behavior

To test:
- yarn cypress run --spec t/cypress/integration/Circulation/bookingsModalDatePicker_spec.ts
- Verify that the "should handle circulation rules date calculations and visual feedback" test now passes

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9c7b02b365)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
Paul Derscheid 2026-02-09 15:25:34 +01:00 committed by Jacob O'Mara
parent 5e82d33938
commit e2ffcfb893
No known key found for this signature in database
1 changed files with 5 additions and 1 deletions

View File

@ -452,6 +452,7 @@ describe("Booking Modal Date Picker Tests", () => {
* └─ Renewal 1 Period (Days 60-64)
*
* Expected Visual Styling:
* - Day 50: Bold (start date)
* - Day 59: Bold (issue period)
* - Day 64: Bold (renewal 1 period)
* - Day 69: Bold (renewal 2 period)
@ -561,9 +562,12 @@ describe("Booking Modal Date Picker Tests", () => {
*/
// Calculate expected bold dates based on circulation rules (like original test)
// Bold dates occur at period endpoints: start + issuelength, start + issuelength + renewalperiod, etc.
// Bold dates occur at: the start date itself, plus period endpoints
const expectedBoldDates = [];
// Start date is always bold (see place_booking.js boldDates = [new Date(startDate)])
expectedBoldDates.push(clearZoneStart);
// Issue period end (after issuelength days)
expectedBoldDates.push(
clearZoneStart.add(dateTestCirculationRules.issuelength, "day")