Files
wanderbooks/crates/ledger-core
swaitsandClaude Sonnet 5.5 268f9aac52 test(core): command steps refuse what their rules refuse
ledger.rs's document command steps ran thin from the core's own suite
(mark_sent_steps not at all; settle and write_off only on their happy
paths; the store's replay tests were their other callers). Each test
drives the public command, names the rule, and checks a refusal changes
nothing (the whole Ledger equals its clone) and a success moves the
figures its rule says.

- mark_sent (BS-arap-2, BS-format-1): a send moves no figure on any date;
  an unknown invoice, a send dated before the invoice, no recipients,
  a TIN or control character in a recipient/reference/note are refused;
  a void invoice is refused by the send's day (a later void doesn't
  un-send); open, partial, paid and written-off invoices may be sent.
- settle (BS-arap-6): empty, mixed kinds, differing parties, unknown
  document, out-of-calendar date, unknown instrument, a revenue account
  as the cash account, duplicate document, non-positive cash, negative
  discount, payment before the document, overpayment, a bad discount
  reason, a discount with no terms and no reason, a fee that is the whole
  payment or above it or on a non-expense account, a closed period; a
  fee settlement posts bank 96.80, fee 3.20, receivable down by the
  gross 100.00; a bill settles as the mirror.
- write_off (BS-arap-5): cash basis, reason, amount, calendar, before the
  invoice, unknown invoice, the room a later payment leaves (70.00 of
  100.00 with a 30.00 payment dated later), a closed period; then the
  write-off at that room posts bad debt 70.00 and clears the receivable.
- aging (BS-arap-2): what is owed on the day, oldest due first, invoices
  and bills apart, not what is paid, void or not yet issued.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 03:08:03 -07:00
..