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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
This commit is contained in:
1 parent
632938fa97
commit
8e683942a2
2 files changed
+15
-6
No files matched your search
@@ -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!([
|
||||
|
||||
@@ -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"},
|
||||
]}),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user