@@ -337,8 +337,8 @@ struct BookingListViewModelTests {
337337 viewModel. loadBookings ( )
338338
339339 // Then
340- #expect( capturedStartDateAfter == " 2021-01-01T00:00:00Z " , " Today tab should filter after start of day " )
341- #expect( capturedStartDateBefore == " 2021-01-01T23:59:59Z " , " Today tab should filter before end of day " )
340+ #expect( capturedStartDateAfter == " 2020-12-31T23:59:59Z " , " Today tab should filter after start of day " )
341+ #expect( capturedStartDateBefore == " 2021-01-02T00:00:00Z " , " Today tab should filter before end of day " )
342342 }
343343
344344 @Test func upcoming_tab_passes_correct_date_filters_to_booking_action( ) {
@@ -471,16 +471,16 @@ struct BookingListViewModelTests {
471471 // Given
472472 let testDate = Date ( timeIntervalSince1970: 1609459200 ) // 2021-01-01 00:00:00 UTC
473473 let todayStart = testDate. startOfDay ( timezone: BookingListTab . utcTimeZone)
474- let todayEnd = testDate. endOfDay ( timezone: BookingListTab . utcTimeZone)
474+ let nextDayStart = testDate. endOfDay ( timezone: BookingListTab . utcTimeZone) . addingTimeInterval ( 1 )
475475
476476 // Create bookings with different start dates
477- let withinTodayBooking = createBooking ( id: 1 , startDate: todayStart. addingTimeInterval ( 3600 ) ) // 1 hour after start
478- let beforeTodayBooking = createBooking ( id: 2 , startDate: todayStart. addingTimeInterval ( - 3600 ) ) // 1 hour before start
479- let afterTodayBooking = createBooking ( id: 3 , startDate: todayEnd . addingTimeInterval ( 3600 ) ) // 1 hour after end
480- let atStartOfDayBooking = createBooking ( id: 4 , startDate: todayStart ) // Exactly at start
481- let atEndOfDayBooking = createBooking ( id: 5 , startDate: todayEnd ) // Exactly at end
477+ let atStartOfDayBooking = createBooking ( id: 1 , startDate: todayStart) // Exactly at start
478+ let withinTodayBooking = createBooking ( id: 2 , startDate: todayStart. addingTimeInterval ( 3600 ) ) // 1 hour after start
479+ let beforeTodayBooking = createBooking ( id: 3 , startDate: todayStart . addingTimeInterval ( - 3600 ) ) // 1 hour before start
480+ let afterTodayBooking = createBooking ( id: 4 , startDate: nextDayStart . addingTimeInterval ( 3600 ) ) // 1 hour after end
481+ let startOfNextDayBooking = createBooking ( id: 5 , startDate: nextDayStart ) // First second of next day
482482
483- insertBookings ( [ withinTodayBooking, beforeTodayBooking, afterTodayBooking, atStartOfDayBooking, atEndOfDayBooking ] )
483+ insertBookings ( [ withinTodayBooking, beforeTodayBooking, afterTodayBooking, atStartOfDayBooking, startOfNextDayBooking ] )
484484
485485 let viewModel = BookingListViewModel ( siteID: sampleSiteID,
486486 type: . today,
@@ -489,8 +489,8 @@ struct BookingListViewModelTests {
489489 currentDate: testDate)
490490
491491 // When/Then - should only show bookings within today (startDate > start AND startDate < end)
492- #expect( viewModel. bookings. count == 1 , " Today tab should only show bookings within today " )
493- #expect( viewModel. bookings. first? . bookingID == withinTodayBooking. bookingID, " Should contain only the booking within today " )
492+ #expect( viewModel. bookings. count == 2 )
493+ #expect( viewModel. bookings. first? . bookingID == withinTodayBooking. bookingID)
494494 }
495495
496496 @Test func upcoming_tab_results_controller_filters_local_storage_correctly( ) {
0 commit comments