Public: anyone can read this; the crew can change it.

Every deal carries an Earnest money deposit date, due a few days after the contract, with reminders to the buyer like the other standard dates #98

Merged opened this

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

Merged

mason/deal-clock:mason/94-every-deal-carries-an-earnest-money-depo → main 1 commit fork

  • Merged. mason/94-every-deal-carries-an-earnest-money-depo was merged into main as 10ba935.

Review

Sign in to review this change.
17 files changed +154 −20
README.md +2 −2
@@ -121,7 +121,7 @@ Signed out, `/` shows what deal-clock does, three short points, a still picture
121121 A date on a weekend or US federal holiday says "not a business day · next is Mon, Nov 30"; tap Move to (N in the terminal) to take that day, reason kept.
122122 10. **Open a new deal.** Back on the clock, tap New deal. Type an address,
123123 buyer, seller, contract date and closing date. The standard lengths are
124 already filled in (inspection 10 days, appraisal 21, financing 30, title 14,
124 already filled in (earnest money deposit 3 days, inspection 10, appraisal 21, financing 30, title 14,
125125 final walkthrough the day before closing) and you can change them; tick
126126 Count business days to skip weekends. Tap Check the dates to see every
127127 date the deal would get (label, weekday and date, who owes it) without
@@ -187,7 +187,7 @@ Your contracts may use other standard contingency lengths. Set them once and
187187 every New deal form, its date preview, the API and the MCP tool start from them
188188 (you can still change any length for one deal):
189189
190 - `DEAL_CLOCK_INSPECTION_DAYS` (brief: 10), `DEAL_CLOCK_APPRAISAL_DAYS` (21),
190 - `DEAL_CLOCK_EARNEST_DAYS` (brief: 3), `DEAL_CLOCK_INSPECTION_DAYS` (10), `DEAL_CLOCK_APPRAISAL_DAYS` (21),
191191 `DEAL_CLOCK_FINANCING_DAYS` (30), `DEAL_CLOCK_TITLE_DAYS` (14): days after the
192192 contract date.
193193 - `DEAL_CLOCK_WALKTHROUGH_DAYS` (1): days before closing.
contract/openapi.json +8
@@ -353,6 +353,12 @@
353353 "type": "string",
354354 "format": "date"
355355 },
356 "earnest": {
357 "type": "integer",
358 "minimum": 0,
359 "maximum": 180,
360 "default": 3
361 },
356362 "inspection": {
357363 "type": "integer",
358364 "minimum": 0,
@@ -633,6 +639,7 @@
633639 },
634640 "kind": {
635641 "enum": [
642 "earnest",
636643 "inspection",
637644 "appraisal",
638645 "financing",
@@ -1949,6 +1956,7 @@
19491956 },
19501957 "kind": {
19511958 "enum": [
1959 "earnest",
19521960 "inspection",
19531961 "appraisal",
19541962 "financing",
docs/TECHNICAL.md +5 −2
@@ -24,8 +24,11 @@ marked sent stay on record. Over the API: `PATCH` or `DELETE
2424 /api/deals/:id/parties/:party` and `DELETE /api/deals/:id/deadlines/:deadline`.
2525
2626 Lead time: every date has `lead_days` (1 to 30, column `deadline.lead_days`,
27 default 3; new Financing dates and the sample deals start at 7, see `leadOf` in
28 `src/deadlines.ts`). The `before` reminder goes out that many days before the due
27 default 3; new Financing dates and the sample deals start at 7, new Earnest money
28 deposit dates at 1, see `leadOf` in `src/deadlines.ts`). The deposit is the
29 buyer's, `DEAL_CLOCK_EARNEST_DAYS` (0 to 180, else 3) after the contract date; it
30 is written only into deals opened and samples restored after it existed, never
31 into an existing deal on boot. The `before` reminder goes out that many days before the due
2932 date (`sendOn`), its label reads "N days before" (`momentLabel`), its words say
3033 "in N days", and the calendar file's early alarm and This week's reminders follow
3134 it; an unsent draft is redrafted, a sent one keeps its approved words. Set it with
src/dates.test.ts +2
@@ -43,6 +43,7 @@ test("business days step over weekends", () => {
4343
4444 test("the standard lengths: inspection 10, appraisal 21, financing 30, walkthrough closing − 1", () => {
4545 expect(DEFAULT_LENGTHS).toMatchObject({
46 earnest: 3,
4647 inspection: 10,
4748 appraisal: 21,
4849 financing: 30,
@@ -57,6 +58,7 @@ test("the standard lengths: inspection 10, appraisal 21, financing 30, walkthrou
5758 }).map((p) => [p.kind, p.due]),
5859 );
5960 expect(dates).toEqual({
61 earnest: "2026-10-15",
6062 inspection: "2026-10-22",
6163 title: "2026-10-26",
6264 appraisal: "2026-11-02",
src/deadlines.ts +12 −1
@@ -27,6 +27,7 @@ export const isPartyRole = (v: unknown): v is PartyRole =>
2727 PARTY_ROLES.includes(v as PartyRole);
2828
2929 export const KINDS = [
30 "earnest",
3031 "inspection",
3132 "appraisal",
3233 "financing",
@@ -46,7 +47,8 @@ export const DEFAULT_LEAD = 3;
4647 export const LEAD_MIN = 1;
4748 export const LEAD_MAX = 30;
4849 /** The lead a new date of this kind starts from: a loan commitment needs a week's warning. */
49 export const leadOf = (kind: Kind): number => (kind === "financing" ? 7 : DEFAULT_LEAD);
50 export const leadOf = (kind: Kind): number =>
51 kind === "financing" ? 7 : kind === "earnest" ? 1 : DEFAULT_LEAD;
5052
5153 export interface KindInfo {
5254 readonly label: string;
@@ -61,6 +63,13 @@ export interface KindInfo {
6163 }
6264
6365 export const KIND: Readonly<Record<Kind, KindInfo>> = {
66 earnest: {
67 label: "Earnest money deposit",
68 tag: "EMD",
69 owes: "buyer",
70 what: "Earnest money deposited with the title company",
71 notify: ["buyer", "title", "other_agent"],
72 },
6473 inspection: {
6574 label: "Inspection period ends",
6675 tag: "Insp",
@@ -114,6 +123,7 @@ export const KIND: Readonly<Record<Kind, KindInfo>> = {
114123
115124 /** The contingency lengths a new deal starts from, each editable on the form. */
116125 export interface Lengths {
126 readonly earnest: number;
117127 readonly inspection: number;
118128 readonly appraisal: number;
119129 readonly financing: number;
@@ -142,6 +152,7 @@ export function schedule(input: {
142152 const { contractDate, closingDate, lengths, businessDays } = input;
143153 const add = businessDays ? addBusinessDays : addDays;
144154 const planned: Planned[] = [
155 { kind: "earnest", due: add(contractDate, lengths.earnest) },
145156 { kind: "inspection", due: add(contractDate, lengths.inspection) },
146157 { kind: "appraisal", due: add(contractDate, lengths.appraisal) },
147158 { kind: "financing", due: add(contractDate, lengths.financing) },
src/deals.test.ts +22 −3
@@ -19,6 +19,7 @@ import {
1919 listDeals,
2020 markDone,
2121 moveDeadline,
22 plan,
2223 removeDeadline,
2324 removeParty,
2425 updateDeal,
@@ -75,6 +76,7 @@ test("opening a deal computes its dates, with the buyer and seller as parties",
7576 const deal = open();
7677 expect(deal.author_name).toBe("alice");
7778 expect(Object.fromEntries(deal.deadlines.map((d) => [d.kind, d.due]))).toEqual({
79 earnest: "2026-10-04",
7880 inspection: "2026-10-11",
7981 title: "2026-10-15",
8082 appraisal: "2026-10-22",
@@ -251,12 +253,12 @@ test("an edited send stores the edited words; an empty body is refused; a sent r
251253 expect(fresh(deal.id).sent.map((s) => s.subject)).toEqual(["Inspection <b>Friday</b>"]);
252254 // Renaming the party leaves the record as it was sent.
253255 db.query("UPDATE party SET name = 'Zed Renamed' WHERE id = ?1").run(buyer.party_id);
254 const again = drafts(fresh(deal.id), agent).find((r) => r.party_id === buyer.party_id && r.moment === "before")!;
256 const again = drafts(fresh(deal.id), agent).find((r) => r.deadline_id === inspection.id && r.party_id === buyer.party_id && r.moment === "before")!;
255257 expect(again.sent_at).not.toBeNull();
256258 expect(again.subject).toBe("Inspection <b>Friday</b>");
257259 expect(again.body).not.toContain("Zed");
258260 // Sent with no words given, the draft as it stands is what is kept.
259 const plain = drafts(fresh(deal.id), agent).find((r) => r.moment === "before" && r.sent_at === null)!;
261 const plain = drafts(fresh(deal.id), agent).find((r) => r.deadline_id === inspection.id && r.moment === "before" && r.sent_at === null)!;
260262 const kept = sendReminder(db, alice, { deadlineId: inspection.id, partyId: plain.party_id, moment: "before" });
261263 expect(kept.ok && kept.value.body).toBe(plain.body);
262264 });
@@ -273,7 +275,7 @@ test("the calendar file: one all-day event per date, alarms, escaped and folded"
273275 const ics = calendar(deal, "clock.example", new Date("2026-10-12T08:00:00Z"));
274276 expect(ics.startsWith("BEGIN:VCALENDAR\r\n")).toBe(true);
275277 expect(ics.endsWith("END:VCALENDAR\r\n")).toBe(true);
276 expect(ics.split("BEGIN:VEVENT").length - 1).toBe(6);
278 expect(ics.split("BEGIN:VEVENT").length - 1).toBe(7);
277279 expect(ics).toContain("DTSTART;VALUE=DATE:20261011\r\nDTEND;VALUE=DATE:20261012");
278280 expect(ics).toContain("UID:deadline-");
279281 expect(ics).toContain("TRIGGER:-P3D");
@@ -627,3 +629,20 @@ test("a date moved away and back is told of each move afresh", () => {
627629 const again = drafts(fresh(deal.id), agent).find((d) => d.moment === "moved" && d.party_id === p.party_id)!;
628630 expect(again.sent_at).toBeNull();
629631 });
632
633 test("the earnest money deposit is the buyer's, three days after the contract, in calendar or business days", () => {
634 const deal = open();
635 const earnest = due(deal, "earnest");
636 expect([earnest.label, earnest.owes, earnest.due, earnest.lead_days]).toEqual(["Earnest money deposit", "buyer", "2026-10-04", 1]);
637 // Three business days from Thursday Oct 1 is Tuesday Oct 6.
638 expect(due(open({ businessDays: "on" }), "earnest").due).toBe("2026-10-06");
639 expect(due(open({ lengths: { earnest: "5" } }), "earnest").due).toBe("2026-10-06");
640 });
641
642 test("an earnest length out of range is refused, naming earnest", () => {
643 for (const bad of ["181", "-1", "x"]) {
644 const r = plan({ address: "1 Oak", buyer: "A", seller: "B", contractDate: "2026-10-01", closingDate: "2026-12-01", lengths: { earnest: bad } });
645 expect(r.ok).toBe(false);
646 if (!r.ok) expect(r.field).toBe("earnest");
647 }
648 });
src/earnest.test.ts added +74
@@ -0,0 +1,74 @@
1 /** The earnest money deposit: validated at the API and MCP boundary, never added to a deal that already exists, carried by the samples. */
2 import { afterAll, expect, test } from "bun:test";
3 import { mkdtempSync } from "node:fs";
4 import { tmpdir } from "node:os";
5 import { join } from "node:path";
6 import { createDeal, listDeals } from "./deals.ts";
7 import { openDb } from "./db.ts";
8 import { restore } from "./sample.ts";
9 import { serve } from "./server.ts";
10 import { sign, type Who } from "./who.ts";
11
12 const alice: Who = { role: "user", id: "u1", name: "alice" };
13
14 const KEY = "a-key-only-the-forge-holds";
15 const server = serve({ port: 0, dataDir: mkdtempSync(join(tmpdir(), "app-emd-")), identityKey: KEY });
16 afterAll(() => server.stop(true));
17 const base = `http://${server.hostname}:${server.port}`;
18 const identity = `u1|alice|user|${Date.now() + 600_000}`;
19 const who = { "x-forge-identity": identity, "x-forge-signature": sign(identity, KEY) };
20 const post = (path: string, body: object) =>
21 fetch(base + path, { method: "POST", headers: { ...who, "content-type": "application/json" }, body: JSON.stringify(body) });
22 const fields = { address: "5 Deposit Way", buyer: "B", seller: "S", contract_date: "2026-10-01", closing_date: "2026-11-01" };
23
24 test("the API takes an earnest length and refuses one out of range, naming earnest", async () => {
25 const bad = await post("/api/deals", { ...fields, earnest: 181 });
26 expect(bad.status).toBeGreaterThanOrEqual(400);
27 expect(bad.status).toBeLessThan(500);
28 expect(JSON.stringify(await bad.json())).toContain("earnest");
29 const ok = await post("/api/deals", { ...fields, earnest: 5 });
30 expect(ok.status).toBe(201);
31 const deal = (await ok.json()) as { deadlines: { kind: string; due: string }[] };
32 expect(deal.deadlines.find((d) => d.kind === "earnest")?.due).toBe("2026-10-06");
33 });
34
35 test("the MCP open_deal tool takes earnest, and refuses an out-of-range one", async () => {
36 const call = async (args: object) =>
37 (await (await post("/mcp", { jsonrpc: "2.0", id: 1, method: "tools/call", params: { name: "open_deal", arguments: args } })).json()) as any;
38 const bad = await call({ ...fields, address: "6 Deposit Way", earnest: 181 });
39 expect(bad.result.isError).toBe(true);
40 expect(JSON.stringify(bad)).toContain("earnest");
41 const ok = await call({ ...fields, address: "7 Deposit Way", earnest: 2 });
42 expect(ok.result.isError).toBeFalsy();
43 expect(ok.result.content[0].text).toContain("2026-10-03");
44 const list = (await (await post("/mcp", { jsonrpc: "2.0", id: 2, method: "tools/list" })).json()) as any;
45 expect(list.result.tools.find((t: any) => t.name === "open_deal").inputSchema.properties.earnest.default).toBe(3);
46 });
47
48 test("a deal made before the deposit existed gains no date when the database boots", () => {
49 const dir = mkdtempSync(join(tmpdir(), "app-emd-old-"));
50 const first = openDb(dir);
51 const made = createDeal(first, alice, { address: "1 Old Deal", buyer: "A", seller: "B", contractDate: "2026-10-01", closingDate: "2026-11-01" });
52 if (!made.ok) throw new Error(made.message);
53 first.query("DELETE FROM deadline WHERE deal_id = ?1 AND kind = 'earnest'").run(made.value.id);
54 first.close();
55 const again = openDb(dir);
56 const listed = listDeals(again, alice);
57 if (!listed.ok) throw new Error(listed.message);
58 expect(listed.value.find((d) => d.id === made.value.id)!.deadlines.map((d) => d.kind)).not.toContain("earnest");
59 });
60
61 test("the restored samples carry the deposit: done on three, ahead on Juniper Court", () => {
62 const db = openDb(mkdtempSync(join(tmpdir(), "app-emd-sample-")));
63 restore(db, "2026-10-01");
64 const rows = db
65 .query<{ address: string; due: string; done_at: string | null }, []>(
66 "SELECT d.address, k.due, k.done_at FROM deadline k JOIN deal d ON d.id = k.deal_id WHERE k.kind = 'earnest' ORDER BY d.id",
67 )
68 .all();
69 expect(rows.length).toBe(4);
70 const by = (a: string) => rows.find((r) => r.address.includes(a))!;
71 expect(by("Alder Lane").done_at).not.toBeNull();
72 expect(by("Juniper").done_at).toBeNull();
73 expect(by("Juniper").due > "2026-10-01").toBe(true);
74 });
src/env.ts +1
@@ -55,6 +55,7 @@ export const agent = {
5555
5656 /** The brief's contingency lengths, in days: what a new deal starts from unless the agent says otherwise. */
5757 export const BRIEF_LENGTHS = {
58 earnest: 3,
5859 inspection: 10,
5960 appraisal: 21,
6061 financing: 30,
src/lead.test.ts +3 −2
@@ -35,10 +35,11 @@ const fresh = (id: number): DealView => {
3535 const kind = (deal: DealView, k: string) => deal.deadlines.find((d) => d.kind === k)!;
3636 const before = (deal: DealView, id: number) => drafts(deal, agent).filter((d) => d.deadline_id === id && d.moment === "before");
3737
38 test("standard dates start at three days; financing starts at seven", () => {
38 test("standard dates start at three days; financing starts at seven, the earnest deposit at one", () => {
3939 const deal = open();
4040 expect(deal.deadlines.map((d) => [d.kind, d.lead_days])).toContainEqual(["financing", 7]);
41 for (const d of deal.deadlines.filter((d) => d.kind !== "financing")) expect(d.lead_days).toBe(3);
41 for (const d of deal.deadlines.filter((d) => d.kind !== "financing" && d.kind !== "earnest")) expect(d.lead_days).toBe(3);
42 expect(deal.deadlines.map((d) => [d.kind, d.lead_days])).toContainEqual(["earnest", 1]);
4243 const financing = kind(deal, "financing");
4344 expect(before(deal, financing.id)[0]!.on).toBe(addDays(financing.due, -7));
4445 expect(before(deal, kind(deal, "inspection").id)[0]!.on).toBe(addDays(kind(deal, "inspection").due, -3));
src/lengths.test.ts +9 −2
@@ -4,7 +4,7 @@ import { BRIEF_LENGTHS, resolveLengths } from "./env.ts";
44
55 test("nothing set: the brief's lengths, calendar days", () => {
66 const r = resolveLengths({});
7 expect(r.lengths).toEqual({ inspection: 10, appraisal: 21, financing: 30, title: 14, walkthrough: 1 });
7 expect(r.lengths).toEqual({ earnest: 3, inspection: 10, appraisal: 21, financing: 30, title: 14, walkthrough: 1 });
88 expect(r.businessDays).toBe(false);
99 expect(BRIEF_LENGTHS.inspection).toBe(10);
1010 });
@@ -18,7 +18,7 @@ test("set values replace the brief's; bad ones fall back without throwing", () =
1818 DEAL_CLOCK_WALKTHROUGH_DAYS: "0",
1919 DEAL_CLOCK_BUSINESS_DAYS: "1",
2020 });
21 expect(r.lengths).toEqual({ inspection: 7, appraisal: 21, financing: 30, title: 14, walkthrough: 0 });
21 expect(r.lengths).toEqual({ earnest: 3, inspection: 7, appraisal: 21, financing: 30, title: 14, walkthrough: 0 });
2222 expect(r.businessDays).toBe(true);
2323 expect(resolveLengths({ DEAL_CLOCK_TITLE_DAYS: "2.5" }).lengths.title).toBe(14);
2424 });
@@ -92,3 +92,10 @@ test("with business days as the agent's standard, a form's unticked box still me
9292 mcpBizDefault: true,
9393 });
9494 });
95
96 test("DEAL_CLOCK_EARNEST_DAYS sets the deposit length; out of range falls back to 3", () => {
97 expect(resolveLengths({ DEAL_CLOCK_EARNEST_DAYS: "5" }).lengths.earnest).toBe(5);
98 expect(resolveLengths({ DEAL_CLOCK_EARNEST_DAYS: "0" }).lengths.earnest).toBe(0);
99 expect(resolveLengths({ DEAL_CLOCK_EARNEST_DAYS: "181" }).lengths.earnest).toBe(3);
100 expect(resolveLengths({ DEAL_CLOCK_EARNEST_DAYS: "soon" }).lengths.earnest).toBe(3);
101 });
src/mcp.ts +2
@@ -256,6 +256,7 @@ export const tools: readonly Tool[] = [
256256 seller: { type: "string", maxLength: 100 },
257257 contract_date: { type: "string", format: "date" },
258258 closing_date: { type: "string", format: "date" },
259 earnest: { type: "integer", minimum: 0, maximum: LENGTH_MAX, default: DEFAULT_LENGTHS.earnest },
259260 inspection: { type: "integer", minimum: 0, maximum: LENGTH_MAX, default: DEFAULT_LENGTHS.inspection },
260261 appraisal: { type: "integer", minimum: 0, maximum: LENGTH_MAX, default: DEFAULT_LENGTHS.appraisal },
261262 financing: { type: "integer", minimum: 0, maximum: LENGTH_MAX, default: DEFAULT_LENGTHS.financing },
@@ -274,6 +275,7 @@ export const tools: readonly Tool[] = [
274275 contractDate: a.contract_date,
275276 closingDate: a.closing_date,
276277 lengths: {
278 earnest: a.earnest,
277279 inspection: a.inspection,
278280 appraisal: a.appraisal,
279281 financing: a.financing,
src/pages/deal.ts +1
@@ -273,6 +273,7 @@ export function newDealPage(input: {
273273 <fieldset>
274274 <legend>Contingency lengths, in days from the contract date</legend>
275275 <div class="lengths">
276 ${length("earnest", "Earnest money deposit")}
276277 ${length("inspection", "Inspection")}
277278 ${length("appraisal", "Appraisal")}
278279 ${length("financing", "Financing")}
src/pages/welcome.ts +1 −1
@@ -24,7 +24,7 @@ function madeUp(on: string): { due: string; tag: string; done: boolean }[] {
2424 return schedule({
2525 contractDate: addDays(on, -12),
2626 closingDate: addDays(on, 18),
27 lengths: { inspection: 10, appraisal: 21, financing: 30, title: 14, walkthrough: 1 },
27 lengths: { earnest: 3, inspection: 10, appraisal: 21, financing: 30, title: 14, walkthrough: 1 },
2828 businessDays: false,
2929 }).map(({ kind, due }) => ({ due, tag: KIND[kind].tag, done: kind === "inspection" }));
3030 }
src/routes.ts +3 −1
@@ -204,7 +204,7 @@ export const DEAL: Schema = {
204204 type: "object",
205205 properties: {
206206 id: { type: "integer" },
207 kind: { enum: ["inspection", "appraisal", "financing", "title", "walkthrough", "closing", "custom"] },
207 kind: { enum: ["earnest", "inspection", "appraisal", "financing", "title", "walkthrough", "closing", "custom"] },
208208 label: { type: "string" },
209209 due: DATE,
210210 owes: ROLE,
@@ -292,6 +292,7 @@ const NEW_DEAL: Schema = {
292292 seller: { type: "string", minLength: 1, maxLength: 100 },
293293 contract_date: DATE,
294294 closing_date: DATE,
295 earnest: { type: "integer", minimum: 0, maximum: 180, default: DEFAULT_LENGTHS.earnest },
295296 inspection: { type: "integer", minimum: 0, maximum: 180, default: DEFAULT_LENGTHS.inspection },
296297 appraisal: { type: "integer", minimum: 0, maximum: 180, default: DEFAULT_LENGTHS.appraisal },
297298 financing: { type: "integer", minimum: 0, maximum: 180, default: DEFAULT_LENGTHS.financing },
@@ -495,6 +496,7 @@ const newDeal = (f: Record<string, unknown>): NewDeal => ({
495496 contractDate: f.contract_date,
496497 closingDate: f.closing_date,
497498 lengths: {
499 earnest: f.earnest,
498500 inspection: f.inspection,
499501 appraisal: f.appraisal,
500502 financing: f.financing,
src/sample.test.ts +2 −2
@@ -38,14 +38,14 @@ test("a sample a person changed is not untouched", () => {
3838 parties: 3, // lender, title, other agent
3939 customs: 1,
4040 reminders: 0,
41 doneAts: ["2026-09-30T17:00:00.000Z", "2026-09-30T17:00:00.000Z", null],
41 doneAts: ["2026-09-30T17:00:00.000Z", "2026-09-30T17:00:00.000Z", "2026-09-30T17:00:00.000Z", null],
4242 moveAuthors: ["Sample data"],
4343 };
4444 expect(isUntouched(state, "2026-10-01")).toBe(true);
4545 expect(isUntouched({ ...state, reminders: 1 }, "2026-10-01")).toBe(false);
4646 expect(isUntouched({ ...state, parties: 4 }, "2026-10-01")).toBe(false);
4747 expect(isUntouched({ ...state, moveAuthors: ["Sample data", "Ana"] }, "2026-10-01")).toBe(false);
48 expect(isUntouched({ ...state, doneAts: ["2026-09-30T17:00:00.000Z", "2026-10-02T08:00:00.000Z", null] }, "2026-10-01")).toBe(false);
48 expect(isUntouched({ ...state, doneAts: ["2026-09-30T17:00:00.000Z", "2026-09-30T17:00:00.000Z", "2026-10-02T08:00:00.000Z", null] }, "2026-10-01")).toBe(false);
4949 expect(isUntouched({ ...state, sample: null }, "2026-10-01")).toBe(false);
5050 });
5151
src/sample.ts +4 −2
@@ -42,7 +42,7 @@ const SAMPLES: readonly Sample[] = [
4242 ["title", "Marcus Lee, Bayside Title", "[email protected]"],
4343 ["other_agent", "Jordan Ellis, Crestline Homes", "(555) 014-2290"],
4444 ],
45 done: ["inspection", "title", "appraisal"],
45 done: ["earnest", "inspection", "title", "appraisal"],
4646 sent: [
4747 "inspection",
4848 "buyer",
@@ -62,6 +62,7 @@ const SAMPLES: readonly Sample[] = [
6262 ["title", "Bayside Title", "[email protected]"],
6363 ["other_agent", "Alicia Moreno, Moreno & Co.", "[email protected]"],
6464 ],
65 done: ["earnest"],
6566 custom: [["HOA documents review ends", 1, "buyer", "Read the HOA budget, rules and minutes; object in writing if needed"]],
6667 },
6768 {
@@ -75,7 +76,7 @@ const SAMPLES: readonly Sample[] = [
7576 ["title", "Northgate Title & Escrow", "[email protected]"],
7677 ["other_agent", "Ben Adeyemi, Lantern Realty", "[email protected]"],
7778 ],
78 done: ["inspection", "title"],
79 done: ["earnest", "inspection", "title"],
7980 custom: [["Repair credit agreed", 5, "seller", "Signed amendment for the roof repair credit"]],
8081 moved: ["appraisal", 2, "Appraiser rescheduled — access to the property"],
8182 },
@@ -85,6 +86,7 @@ const SAMPLES: readonly Sample[] = [
8586 seller: "Carla Mendes",
8687 contract: -3,
8788 closing: 40,
89 lengths: { earnest: 5 },
8890 parties: [
8991 ["lender", "Owen Brandt, First Keel Bank", "[email protected]"],
9092 ["other_agent", "Jordan Ellis, Crestline Homes", "(555) 014-2290"],
src/terminal.test.ts +3 −2
@@ -156,7 +156,7 @@ test("n opens a deal from five answers, and shows it", () => {
156156 if (!listed.ok) throw new Error(listed.message);
157157 const made = listed.value.find((d) => d.address === "31 Birch Row");
158158 expect(made?.parties.map((p) => p.name)).toEqual(["Kim Buyer", "Lou Seller"]);
159 expect(made?.deadlines.length).toBe(6);
159 expect(made?.deadlines.length).toBe(7);
160160 expect(lines(t).join("\n")).toContain("Opened 31 Birch Row");
161161 expect(lines(t)).toContain("31 Birch Row");
162162 // A bad answer is the action's to refuse, and nothing is opened.
@@ -392,7 +392,8 @@ test("R then yes puts the sample deals back, leaving a person's deal alone", ()
392392 expect(harbor().deadlines.find((d) => d.id === first.id)!.done_at).not.toBeNull();
393393 press(t, "R", "yes\r");
394394 expect(lines(t).join("\n")).toContain("Sample deals restored.");
395 expect(harbor().deadlines.every((d) => d.done_at === null)).toBe(true);
395 // The sample writes Harbor View with its earnest money deposit already made; every other date is open again.
396 expect(harbor().deadlines.every((d) => (d.kind === "earnest") === (d.done_at !== null))).toBe(true);
396397 expect(getDeal(db, alice, { id }).ok).toBe(true);
397398 });
398399

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs