oficina / calendar Public

Select a booking slot outside withdrawn hours independently of clock time

Paul Campbell pushed by paul@keymail.dev cde0d6fc00048fc172b82c75009cbc9b98f89206 parent 423b3b5
1 file changed, +13 −1
  • internal/calendartest/booking_review2_test.go +13 −1

CI passed — run details

diff --git a/internal/calendartest/booking_review2_test.go b/internal/calendartest/booking_review2_test.go
index dd5d957..44babe8 100644
--- a/internal/calendartest/booking_review2_test.go
+++ b/internal/calendartest/booking_review2_test.go
@@ -77,7 +77,19 @@ func TestARescheduleIntoWithdrawnHoursIsRefused(t *testing.T) {
slots := slotsFor(t, app, page, host, now, 3)
b, _ := st.HoldBooking(ctx, holdInput(page, host, slots[0], "doc@tito.io", "ip"), now)
st.ConfirmBooking(ctx, b.ID, now)
- late := slots[len(slots)-1] // 16:30 on the third day: outside 9-10
+ loc, err := calendar.Zone(host.Zone)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var late calendar.Slot
+ for _, slot := range slots {
+ if time.Unix(slot.StartUTC, 0).In(loc).Hour() >= 10 {
+ late = slot
+ }
+ }
+ if late.StartUTC == 0 {
+ t.Fatal("no slot outside the withdrawn hours")
+ }
ws, _ := calendar.ParseAvailability("every day 9-10")
app.SetAfterSlotCheckForTest(func() {