test(core): golden file for the trial balance as of a date

Add a golden for trial_balance_as_of on 2026-01-31 over the shared
extended January fixture. The as-of applies before the close is read, so
this is the post-closing trial balance: revenue and rent net to zero and
the close's 3,200 sits in retained earnings; the Feb 5 entry is after the
as-of date and is out.

Hand recomputation (plan/golden-worksheets/trial-balance-as-of.md):
cash net debit 10,000 + 1,500 - 2,500 - 800 - 1,000 = 7,200;
receivables 4,000 - 1,500 = 2,500; equipment 2,500 + 1,500 = 4,000;
payable credit 500; owner's equity credit 10,000; retained earnings
credit 3,200. Service revenue and rent expense each have equal debits and
credits after the close, so neither is listed. Totals: debits 13,700,
credits 500 + 10,000 + 3,200 = 13,700. The Feb 5 entry would have added
600 to each column; the golden pins the January figures.

Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
This commit is contained in:
swaitsandDeepSeek V4.1 Flash committed 2026-11-07 10:00:05 -07:00
1 parent be9bb02e1b
commit 73e1210248
3 files changed
+121 -1

No files matched your search

@@ -0,0 +1,42 @@
{
"lines": [
{
"code": "1000",
"name": "Cash",
"debit": "7200",
"credit": "0"
},
{
"code": "1200",
"name": "Accounts Receivable",
"debit": "2500",
"credit": "0"
},
{
"code": "1500",
"name": "Equipment",
"debit": "4000",
"credit": "0"
},
{
"code": "2000",
"name": "Accounts Payable",
"debit": "0",
"credit": "500"
},
{
"code": "3000",
"name": "Owner's Equity",
"debit": "0",
"credit": "10000"
},
{
"code": "3999",
"name": "Retained Earnings",
"debit": "0",
"credit": "3200"
}
],
"total_debits": "13700",
"total_credits": "13700"
}
+12 -1
View File
@@ -11,7 +11,7 @@
//! `plan/golden-worksheets/`; see the worksheet named in each test.
use chrono::NaiveDate;
use ledger_core::reports::{balance_sheet_as_of, profit_and_loss_for_period};
use ledger_core::reports::{balance_sheet_as_of, profit_and_loss_for_period, trial_balance_as_of};
use ledger_core::{AccountId, AccountType, Currency, Ledger, Money, Side};
use rust_decimal::Decimal;
@@ -164,3 +164,14 @@ fn golden_balance_sheet_as_of() {
serde_json::from_str(include_str!("golden/balance_sheet_as_of.json")).unwrap();
assert_eq!(got, want);
}
/// By-hand worksheet: `plan/golden-worksheets/trial-balance-as-of.md`.
#[test]
fn golden_trial_balance_as_of() {
let ledger = golden_company();
let report = trial_balance_as_of(&ledger, date(31));
let got = serde_json::to_value(&report).unwrap();
let want: serde_json::Value =
serde_json::from_str(include_str!("golden/trial_balance_as_of.json")).unwrap();
assert_eq!(got, want);
}