Public: anyone can read this; the crew can change it.
The clock's marker for a listing agreement that expires before closing says so in its own words, not "falls on or after closing" #204
Check · Review · Land · Live done — Landed and live in production.
mason/deal-clock:mason/202-the-clock-s-marker-for-a-listing-agreeme → main 4 commits fork 2 threads · 2 unresolved
4 files
changed +21
−3
src/order.page.test.ts +3
| @@ -29,6 +29,9 @@ test("on a fresh boot only 9 Orchard Row is flagged, for its listing expiring be | ||
| 29 | 29 | expect(deal.conflicts.map((c) => c.label)).toEqual(deal.address === "9 Orchard Row" ? ["Listing agreement expires"] : []); |
| 30 | 30 | const page = await (await fetch(`${base}/`, { headers: alice })).text(); |
| 31 | 31 | expect(page).toContain("1 out of order"); |
| 32 | const label = page.match(/aria-label="(Listing agreement expires[^"]*)"/)![1]!; | |
| 33 | expect(label).toContain("closing falls after the listing agreement expires"); | |
| 34 | expect(label).not.toContain("falls on or after closing"); | |
| 32 | 35 | }); |
| 33 | 36 | |
| 34 | 37 | test("moving Alder Lane's financing past closing succeeds and shows the flag everywhere", async () => { |
src/order.test.ts +11 −1
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | import { expect, test } from "bun:test"; |
| 2 | import { conflictLine, conflicts } from "./order.ts"; | |
| 2 | import { conflictLine, conflictShort, conflicts } from "./order.ts"; | |
| 3 | import { LISTING_EXPIRES } from "./deadlines.ts"; | |
| 3 | 4 | |
| 4 | 5 | const d = (id: number, kind: string, due: string, done_at: string | null = null) => ({ |
| 5 | 6 | id, |
| @@ -33,3 +34,12 @@ test("the line says it in words", () => { | ||
| 33 | 34 | expect(conflictLine(c)).toBe("Financing (Nov 24) now falls after closing (Nov 20): move one or the other."); |
| 34 | 35 | expect(conflictLine({ ...c, due: "2026-11-20" })).toContain("now falls on closing"); |
| 35 | 36 | }); |
| 37 | ||
| 38 | test("the marker's short words: the listing's own, or on or after closing", () => { | |
| 39 | const listing = { deadline_id: 1, label: LISTING_EXPIRES, due: "2026-11-30", closing: "2026-12-03" }; | |
| 40 | expect(conflictShort(listing)).toBe("closing falls after the listing agreement expires"); | |
| 41 | expect(conflictShort({ ...listing, due: "2026-12-03" })).toBe("closing falls on the day the listing agreement expires"); | |
| 42 | const late = { deadline_id: 2, label: "Financing", due: "2026-11-24", closing: "2026-11-20" }; | |
| 43 | expect(conflictShort(late)).toBe("falls on or after closing"); | |
| 44 | expect(conflictShort({ ...late, due: "2026-11-20" })).toBe("falls on or after closing"); | |
| 45 | }); |
src/order.ts +4
| @@ -41,3 +41,7 @@ export const conflictLine = (c: Conflict): string => | ||
| 41 | 41 | c.label === LISTING_EXPIRES |
| 42 | 42 | ? `Closing (${short(c.closing)}) falls ${c.due === c.closing ? "on the day" : "after"} the listing agreement expires (${short(c.due)}): extend the listing or move closing.` |
| 43 | 43 | : `${c.label} (${short(c.due)}) now falls ${c.due === c.closing ? "on" : "after"} closing (${short(c.closing)}): move one or the other.`; |
| 44 | ||
| 45 | /** The conflict in a few words, for a marker's spoken label: "closing falls after the listing agreement expires"; otherwise "falls on or after closing". */ | |
| 46 | export const conflictShort = (c: Conflict): string => | |
| 47 | c.label === LISTING_EXPIRES ? `closing falls ${c.due === c.closing ? "on the day" : "after"} the listing agreement expires` : "falls on or after closing"; | |
src/pages/clock.ts +3 −2
| @@ -12,6 +12,7 @@ import { escape } from "../http.ts"; | ||
| 12 | 12 | import { agent as defaults } from "../env.ts"; |
| 13 | 13 | import { todaysDrafts, unsent, type Agent } from "../reminders.ts"; |
| 14 | 14 | import type { Who } from "../who.ts"; |
| 15 | import { conflictShort } from "../order.ts"; | |
| 15 | 16 | import { clashLine, clashesLine } from "../overlap.ts"; |
| 16 | 17 | import { byDay, thisWeek, whereNote } from "../week.ts"; |
| 17 | 18 | import { layout } from "./layout.ts"; |
| @@ -66,8 +67,8 @@ function drawLane(deal: DealView, start: string, on: string): string { | ||
| 66 | 67 | const d = deal.deadlines[i]!; |
| 67 | 68 | const u = urgencyOf(d, on); |
| 68 | 69 | const tag = d.kind === "custom" ? d.label.split(" ")[0]! : KIND[d.kind].tag; |
| 69 | const flagged = deal.conflicts.some((c) => c.deadline_id === d.id); | |
| 70 | return `<a class="marker" data-u="${u}"${flagged ? " data-conflict" : ""} ${opens(deal, d)} style="left:${at(x)};top:calc(${row} * 3rem)" aria-label="${escape(`${d.label}, ${spoken(d.due)} — ${URGENCY_LABEL[u]}${flagged ? " — falls on or after closing" : ""}`)}"><span class="dot"></span>${escape(tag)}</a>`; | |
| 70 | const flagged = deal.conflicts.find((c) => c.deadline_id === d.id); | |
| 71 | return `<a class="marker" data-u="${u}"${flagged !== undefined ? " data-conflict" : ""} ${opens(deal, d)} style="left:${at(x)};top:calc(${row} * 3rem)" aria-label="${escape(`${d.label}, ${spoken(d.due)} — ${URGENCY_LABEL[u]}${flagged ? ` — ${conflictShort(flagged)}` : ""}`)}"><span class="dot"></span>${escape(tag)}</a>`; | |
| 71 | 72 | }) |
| 72 | 73 | .join(""); |
| 73 | 74 | return `<li class="lane"> |
new above
offline
The on-the-day branch and the non-listing branch are not covered by any test. Add unit tests for both.