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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

mason/deal-clock:mason/242-on-a-fresh-boot-the-clock-s-first-remind → main 1 commit fork

  • Merged. mason/242-on-a-fresh-boot-the-clock-s-first-remind was merged into main as f1f5623.

Review

Sign in to review this change.
2 files changed +14 −3
src/sample.test.ts +12 −1
@@ -11,7 +11,7 @@ import { people } from "./people.ts";
1111 import { thisWeek } from "./week.ts";
1212 import { addDays, today, DEFAULT_ZONE } from "./dates.ts";
1313 import { createDeal, listDeals, markDone } from "./deals.ts";
14 import { drafts, unsent } from "./reminders.ts";
14 import { drafts, todaysDrafts, unsent } from "./reminders.ts";
1515 import type { Who } from "./who.ts";
1616 import { isUntouched, refresh, restore, shiftSample, type SampleDates } from "./sample.ts";
1717
@@ -231,3 +231,14 @@ test("every open sample inspection and walkthrough has a quarter-hour time and a
231231 refresh(db, addDays(today(DEFAULT_ZONE), 3));
232232 check();
233233 });
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[] = [
6161 price: 425_000,
6262 rate: 250,
6363 earnest: 12_750,
64 lengths: { financing: 28 },
64 lengths: { financing: 26 },
6565 closingAt: ["14:00", "Bayside Title, 400 Main St"],
6666 parties: [
6767 ["lender", "Priya Nair, Coastline Mortgage", "[email protected]", "(555) 010-0177"],
@@ -93,7 +93,7 @@ const SAMPLES: readonly Sample[] = [
9393 ],
9494 done: ["earnest"],
9595 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"]],
9797 },
9898 {
9999 address: "9 Orchard Row",

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs