From bf91c5a7c21d12d6c518de09c7a779df459caf0b Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Tue, 27 Oct 2026 02:04:17 -0600 Subject: [PATCH] test(settings): S4.1's Terms canonicalizes a short custom date (P4b S4.2) The landed Terms::parse reads a date chrono reads and prints it padded, so "Due 2026-1-5" is one value with "Due 2026-01-05", not a refusal. The settings key still keeps one spelling; the test now asserts that canonicalization instead of refusing the short form. --- crates/ledger-core/tests/settings_units.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/ledger-core/tests/settings_units.rs b/crates/ledger-core/tests/settings_units.rs index 8ade403..52a5245 100644 --- a/crates/ledger-core/tests/settings_units.rs +++ b/crates/ledger-core/tests/settings_units.rs @@ -467,6 +467,9 @@ fn terms_keep_one_canonical_spelling() { assert_eq!(terms("2/10 net 30"), Ok(json!("2/10 net 30"))); assert_eq!(terms("Due On Receipt"), Ok(json!("Due on receipt"))); assert_eq!(terms("due 2026-11-15"), Ok(json!("Due 2026-11-15"))); + // S4.1's parse reads a date chrono can read and canonicalizes it, so a + // single-digit month and day get their zero padding in the one value. + assert_eq!(terms("Due 2026-1-5"), Ok(json!("Due 2026-01-05"))); assert_eq!(terms("2.5/10 net 30"), Ok(json!("2.5/10 net 30"))); for bad in [ "net", @@ -477,7 +480,6 @@ fn terms_keep_one_canonical_spelling() { "2/10 net 15 eom", "2/10 net 30 extra", "Due 9999-13-01", - "Due 2026-1-5", "", ] { assert!(terms(bad).is_err(), "{bad:?}");