test(mcp): exercise the write-off in the happy path (P4b S7)

spec_mcp's inv1 walks every tool once and fails on any the books never
answered: the happy path now creates an invoice that will not be paid,
uploads the collection letter, and writes it off with the evidence in the
same call, so books.write_off_invoice's output schema is checked like
every other tool's.
This commit is contained in:
swaits committed 2026-10-27 12:44:45 -06:00
1 parent 0322778683
commit e801908a88
1 file changed
+14
+14
View File
@@ -896,6 +896,20 @@ fn happy_path(name: &str) -> Mcp {
json!({"kind": "invoices", "status": "all"}),
);
m.ok("books.document", json!({"ref": format!("invoice:{inv}")}));
// P4b S7: a bad debt, its evidence uploaded and filed with it.
let bad = m.ok(
"books.create_invoice",
json!({"party_id": customer, "date": "2026-02-03", "due_date": "2026-03-03",
"lines": [{"description": "Consulting, never paid", "amount": "400.00"}]}),
)["id"]
.as_u64()
.unwrap();
let letter = m.upload(b"Final demand", "letter.txt", "text/plain", "document");
m.ok(
"books.write_off_invoice",
json!({"invoice": bad, "date": "2026-03-01", "reason": "collection exhausted",
"upload_id": letter, "confirmed": true}),
);
// Fixed assets.
let registered = m.ok(