Skip to content

Scheduling rule tests

These run now in your browser against fixed dates (week of 7 Oct 2026) and a fixed "now", so results never depend on today's clock. They exercise the exact same rule code used by /book, rescheduling, and the /demo claim step. The same cases run as automated tests in the codebase.

27 of 27 passed

Portland time

  • PASS
    Summer offset is UTC−7 (PDT)
  • PASS
    Winter offset is UTC−8 (PST)
  • PASS
    9:00 AM PT in December = 17:00 UTC

Mon–Fri 9–5

  • PASS
    First weekday start is 9:00 AM PT
  • PASS
    Last 30-min start is 4:30 PM PT (ends 5:00)
  • PASS
    Last 45-min start is 4:15 PM PT
  • PASS
    Saturday has no slots
  • PASS
    Sunday has no slots

1-hour lead time

  • PASS
    At 8:30 AM, 9:00 and 9:15 are too soon
  • PASS
    At 8:30 AM, 9:30 is the first bookable start
  • PASS
    Saving a too-soon start is rejected

Duration + 15-min turnover

  • PASS
    9:15 (ends 9:45, 15 min gap) stays open
  • PASS
    9:30 (ends 10:00, no gap) is blocked
  • PASS
    10:30 (no gap after) is blocked
  • PASS
    10:45 (15 min after) is open
  • PASS
    A 45-min visit at 9:00 (ends 9:45) fits before 10:00

Overlap rejection

  • PASS
    Saving 10:15 over a 10:00 visit is rejected
  • PASS
    Raw overlap detector flags touching visits
  • PASS
    Saving an off-grid 10:07 start is rejected

Reschedule

  • PASS
    Moving X onto Y's 11:00 is rejected
  • PASS
    Moving X to 2:00 PM is allowed
  • PASS
    After the move, X's old 10:00 slot is released
  • PASS
    …and X's new 2:00 PM slot is now taken

No availability

  • PASS
    A fully booked Wednesday has no open slots
  • PASS
    Next open time is Thursday 9:00 AM PT
  • PASS
    A full Friday skips the weekend to Monday 9:00 AM
  • PASS
    Nothing open for 21 days → null (call the clinic)

What is and isn't protected on the server

  • Saving a booking and rescheduling re-run these rules on the server against the live schedule (the old appointment is excluded, so its slot is released on move). A bad or taken time is rejected.
  • The check and the save are two steps, not one database transaction — two patients submitting the same slot in the same instant could in theory both succeed. There's no database-level lock yet.
  • The /demo page runs these rules in your browser on synthetic data only.