Public: anyone can read this; the crew can change it.
On a fresh boot the clock's first reminder for today is one that is already late #246
Check · Review · Land · Live done — Landed and live in production.
mason/deal-clock:mason/242-on-a-fresh-boot-the-clock-s-first-remind → main 1 commit fork
2 files
changed +14
−3
src/sample.test.ts +12 −1
| @@ -11,7 +11,7 @@ import { people } from "./people.ts"; | ||
| 11 | 11 | import { thisWeek } from "./week.ts"; |
| 12 | 12 | import { addDays, today, DEFAULT_ZONE } from "./dates.ts"; |
| 13 | 13 | import { createDeal, listDeals, markDone } from "./deals.ts"; |
| 14 | import { drafts, unsent } from "./reminders.ts"; | |
| 14 | import { drafts, todaysDrafts, unsent } from "./reminders.ts"; | |
| 15 | 15 | import type { Who } from "./who.ts"; |
| 16 | 16 | import { isUntouched, refresh, restore, shiftSample, type SampleDates } from "./sample.ts"; |
| 17 | 17 | |
| @@ -231,3 +231,14 @@ test("every open sample inspection and walkthrough has a quarter-hour time and a | ||
| 231 | 231 | refresh(db, addDays(today(DEFAULT_ZONE), 3)); |
| 232 | 232 | check(); |
| 233 | 233 | }); |
| 234 | ||
| 235 | test("on a fresh boot the first reminder for today is for a date already late or due today", () => { | |
| 236 | const db = openDb(mkdtempSync(join(tmpdir(), "app-sample-first-"))); | |
| 237 | const alice: Who = { role: "user", id: "u1", name: "alice" }; | |
| 238 | const listed = listDeals(db, alice); | |
| 239 | if (!listed.ok) throw new Error(listed.message); | |
| 240 | const day = today(DEFAULT_ZONE); | |
| 241 | const first = todaysDrafts(listed.value, day, agent)[0]!; | |
| 242 | expect(first).toBeDefined(); | |
| 243 | expect(first.moment === "late" || first.due <= day).toBe(true); | |
| 244 | }); |
src/sample.ts +2 −2
| @@ -61,7 +61,7 @@ const SAMPLES: readonly Sample[] = [ | ||
| 61 | 61 | price: 425_000, |
| 62 | 62 | rate: 250, |
| 63 | 63 | earnest: 12_750, |
| 64 | lengths: { financing: 28 }, | |
| 64 | lengths: { financing: 26 }, | |
| 65 | 65 | closingAt: ["14:00", "Bayside Title, 400 Main St"], |
| 66 | 66 | parties: [ |
| 67 | 67 | ["lender", "Priya Nair, Coastline Mortgage", "[email protected]", "(555) 010-0177"], |
| @@ -93,7 +93,7 @@ const SAMPLES: readonly Sample[] = [ | ||
| 93 | 93 | ], |
| 94 | 94 | done: ["earnest"], |
| 95 | 95 | notes: [["inspection", "Inspector booked for Friday 9am; seller will leave the attic open"]], |
| 96 | custom: [["HOA documents review ends", 1, "buyer", "Read the HOA budget, rules and minutes; object in writing if needed"]], | |
| 96 | custom: [["HOA documents review ends", 9, "buyer", "Read the HOA budget, rules and minutes; object in writing if needed"]], | |
| 97 | 97 | }, |
| 98 | 98 | { |
| 99 | 99 | address: "9 Orchard Row", |
new above
offline