From 8e683942a2127c75694c9bbcd07fe190d77982c6 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Thu, 29 Oct 2026 15:41:46 -0600 Subject: [PATCH] test: the alias sweep reaches the two tests that built their arguments in a closure and a loop (P5) projects_parity built both its invoices and its bill through one closure that passed party_id, and spec_projects looped over (invoice, bill) with one spelling; with the aliases gone each names customer or vendor as its tool takes it. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp --- crates/ledger-cli/tests/projects_parity.rs | 7 +++++-- crates/ledger-cli/tests/spec_projects.rs | 14 ++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/crates/ledger-cli/tests/projects_parity.rs b/crates/ledger-cli/tests/projects_parity.rs index 93261b2..1ffd3f6 100644 --- a/crates/ledger-cli/tests/projects_parity.rs +++ b/crates/ledger-cli/tests/projects_parity.rs @@ -230,8 +230,8 @@ fn invoiced_and_billed_project_figures_are_the_same_in_the_viewer_and_from_the_s server.tool("books.add_project", json!({"name": "Heron"})); let cedar = server.tool("books.add_customer", json!({"name": "Cedar Client"}))["id"].clone(); let dana = server.tool("books.add_vendor", json!({"name": "Dana Illustration"}))["id"].clone(); - let doc = |party: &Value, date: &str, lines: Value| { - json!({"party_id": party, "date": date, "due_date": date, "lines": lines, + let doc = |key: &str, party: &Value, date: &str, lines: Value| { + json!({key: party.to_string(), "date": date, "due_date": date, "lines": lines, "confirmed": true}) }; server.tool( @@ -241,6 +241,7 @@ fn invoiced_and_billed_project_figures_are_the_same_in_the_viewer_and_from_the_s let inv = server.tool( "books.create_invoice", doc( + "customer", &cedar, "2026-02-02", json!([ @@ -253,6 +254,7 @@ fn invoiced_and_billed_project_figures_are_the_same_in_the_viewer_and_from_the_s let inv2 = server.tool( "books.create_invoice", doc( + "customer", &cedar, "2026-05-04", json!([{"description": "Build", "amount": "4321.09", "class": "kestrel"}]), @@ -262,6 +264,7 @@ fn invoiced_and_billed_project_figures_are_the_same_in_the_viewer_and_from_the_s .wire .upload(b"Dana's invoice", "dana.pdf", "application/pdf", "receipt"); let mut bill_args = doc( + "vendor", &dana, "2026-03-09", json!([ diff --git a/crates/ledger-cli/tests/spec_projects.rs b/crates/ledger-cli/tests/spec_projects.rs index 26cdc2b..e861fc6 100644 --- a/crates/ledger-cli/tests/spec_projects.rs +++ b/crates/ledger-cli/tests/spec_projects.rs @@ -1353,10 +1353,13 @@ fn a_document_naming_an_unknown_project_is_refused_whole() { m.ok("books.add_project", json!({"name": "Zeta site"})); let cedar = m.ok("books.add_customer", json!({"name": "Cedar"}))["id"].clone(); let v = m.ok("books.add_vendor", json!({"name": "Dana"}))["id"].clone(); - for (tool, party) in [("books.create_invoice", &cedar), ("books.create_bill", &v)] { + for (tool, key, party) in [ + ("books.create_invoice", "customer", &cedar), + ("books.create_bill", "vendor", &v), + ] { let why = m.refuse( tool, - json!({"customer": (party).to_string(), "date": "2026-03-02", "due_date": "2026-04-01", "lines": [ + json!({key: (party).to_string(), "date": "2026-03-02", "due_date": "2026-04-01", "lines": [ {"description": "a", "amount": "10.00", "class": "Zeta site"}, {"description": "b", "amount": "10.00", "class": "Nowhere"}, ]}), @@ -1472,10 +1475,13 @@ fn books_without_the_feature_refuse_a_tagged_document() { let cedar = m.ok("books.add_customer", json!({"name": "Cedar"}))["id"].clone(); let v = m.ok("books.add_vendor", json!({"name": "Dana"}))["id"].clone(); let head = m.journal(); - for (tool, party) in [("books.create_invoice", &cedar), ("books.create_bill", &v)] { + for (tool, key, party) in [ + ("books.create_invoice", "customer", &cedar), + ("books.create_bill", "vendor", &v), + ] { let why = m.refuse( tool, - json!({"customer": (party).to_string(), "date": "2026-03-02", "due_date": "2026-04-01", "lines": [ + json!({key: (party).to_string(), "date": "2026-03-02", "due_date": "2026-04-01", "lines": [ {"description": "a", "amount": "10.00", "class": "Zeta site"}, ]}), );