test(core): golden file for the 1099 vendor worksheet
The `books()` fixture's worksheet is now a golden: 2025 and 2026, so the year boundary and both thresholds (600 and 2,000) are pinned. Recomputing it by hand from rules.md B-19 before serializing the report: - Dana: 1,500 bill payment + 700 direct = 2,200 in 2026 (reportable at 2,000); the 300 dated 2025-12-30 counts only in 2025 (under 600). - Ace Rentals: 1,200 in January; the February 1,200 and its reversal net to zero, so 1,200, under 2,000. - Sam: 5,000 charged to 2100, which no cash, financing or business-card method names, so no payment line: paid 0, under. The card exclusion is the fixture's documented "nothing counts" case. - Bigco: 9,000 from the bank while never decided: undetermined, a decision needed, never reportable until one is made. - The untagged 50.00 contract-labor payment is the quieter note. Every field agrees with the hand worksheet in plan/golden-worksheets/1099-worksheet.md. `Vendor1099Report`, `Vendor1099Line` and `Payment1099` gain serde derives so the report can be serialized; no existing golden or assertion changes. Co-Authored-By: DeepSeek V4.1 Flash <noreply@opencode.ai>
This commit is contained in:
1 parent
d075235559
commit
025c0942ee
4 files changed
+373
-3
No files matched your search
@@ -494,7 +494,7 @@ impl Status1099 {
|
||||
}
|
||||
|
||||
/// One vendor's year.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct Vendor1099Line {
|
||||
/// The vendor.
|
||||
pub vendor_id: VendorId,
|
||||
@@ -542,7 +542,7 @@ impl Vendor1099Line {
|
||||
}
|
||||
|
||||
/// One payment on a vendor's year, for the worksheet's lists.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct Payment1099 {
|
||||
/// The entry.
|
||||
pub entry_id: EntryId,
|
||||
@@ -557,7 +557,7 @@ pub struct Payment1099 {
|
||||
}
|
||||
|
||||
/// The year's 1099 report.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct Vendor1099Report {
|
||||
/// Calendar year.
|
||||
pub year: i32,
|
||||
|
||||
@@ -2511,3 +2511,23 @@ fn card_accounts_are_the_company_cards_liabilities() {
|
||||
[m.card]
|
||||
);
|
||||
}
|
||||
|
||||
/// Golden (oracle Layer 1): the worksheet's figures for the hand-verified
|
||||
/// fixture above, every one recomputed from the entries in
|
||||
/// plan/golden-worksheets/1099-worksheet.md before this test was run.
|
||||
/// 2025 and 2026 together pin the year boundary: Dana's 300.00 on
|
||||
/// 2025-12-30 counts in 2025 only, and the threshold moves from 600 to
|
||||
/// 2,000 (rules.md B-19).
|
||||
#[test]
|
||||
fn golden_1099_worksheet() {
|
||||
let l = books();
|
||||
let r2026 = report_for(&l, 2026, None, &[]).unwrap();
|
||||
let r2025 = report_for(&l, 2025, None, &[]).unwrap();
|
||||
let got = serde_json::json!({
|
||||
"2025": serde_json::to_value(&r2025).unwrap(),
|
||||
"2026": serde_json::to_value(&r2026).unwrap(),
|
||||
});
|
||||
let want: serde_json::Value =
|
||||
serde_json::from_str(include_str!("golden/form1099_worksheet.json")).unwrap();
|
||||
assert_eq!(got, want);
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
{
|
||||
"2025": {
|
||||
"excluded_card_payments": [],
|
||||
"other_receipts": [],
|
||||
"threshold": "600",
|
||||
"through": null,
|
||||
"undetermined_payments": [],
|
||||
"unresolved": [],
|
||||
"untagged_payments": [],
|
||||
"vendors": [
|
||||
{
|
||||
"decided": {
|
||||
"decided_by": "Riley Chen",
|
||||
"decided_on": "2026-01-05"
|
||||
},
|
||||
"decision": {
|
||||
"files": "misc"
|
||||
},
|
||||
"decision_needed": false,
|
||||
"decisions": [
|
||||
{
|
||||
"decision": {
|
||||
"files": "misc"
|
||||
},
|
||||
"effective": null,
|
||||
"source": {
|
||||
"decided_by": "Riley Chen",
|
||||
"decided_on": "2026-01-05"
|
||||
}
|
||||
}
|
||||
],
|
||||
"effective": null,
|
||||
"excluded_card": "0",
|
||||
"name": "Ace Rentals",
|
||||
"not_reportable": "0",
|
||||
"paid": "0",
|
||||
"reportable": false,
|
||||
"status": "under_threshold",
|
||||
"tin_on_file": false,
|
||||
"undetermined": "0",
|
||||
"vendor_id": 2
|
||||
},
|
||||
{
|
||||
"decided": {
|
||||
"decided_by": "Riley Chen",
|
||||
"decided_on": "2026-01-05"
|
||||
},
|
||||
"decision": {
|
||||
"files": "nec"
|
||||
},
|
||||
"decision_needed": false,
|
||||
"decisions": [
|
||||
{
|
||||
"decision": {
|
||||
"files": "nec"
|
||||
},
|
||||
"effective": null,
|
||||
"source": {
|
||||
"decided_by": "Riley Chen",
|
||||
"decided_on": "2026-01-05"
|
||||
}
|
||||
}
|
||||
],
|
||||
"effective": null,
|
||||
"excluded_card": "0",
|
||||
"name": "Dana",
|
||||
"not_reportable": "0",
|
||||
"paid": "300",
|
||||
"reportable": false,
|
||||
"status": "under_threshold",
|
||||
"tin_on_file": true,
|
||||
"undetermined": "0",
|
||||
"vendor_id": 1
|
||||
},
|
||||
{
|
||||
"decided": {
|
||||
"decided_by": "Riley Chen",
|
||||
"decided_on": "2026-01-05"
|
||||
},
|
||||
"decision": {
|
||||
"files": "nec"
|
||||
},
|
||||
"decision_needed": false,
|
||||
"decisions": [
|
||||
{
|
||||
"decision": {
|
||||
"files": "nec"
|
||||
},
|
||||
"effective": null,
|
||||
"source": {
|
||||
"decided_by": "Riley Chen",
|
||||
"decided_on": "2026-01-05"
|
||||
}
|
||||
}
|
||||
],
|
||||
"effective": null,
|
||||
"excluded_card": "0",
|
||||
"name": "Sam",
|
||||
"not_reportable": "0",
|
||||
"paid": "0",
|
||||
"reportable": false,
|
||||
"status": "under_threshold",
|
||||
"tin_on_file": true,
|
||||
"undetermined": "0",
|
||||
"vendor_id": 3
|
||||
}
|
||||
],
|
||||
"year": 2025
|
||||
},
|
||||
"2026": {
|
||||
"excluded_card_payments": [],
|
||||
"other_receipts": [],
|
||||
"threshold": "2000",
|
||||
"through": null,
|
||||
"undetermined_payments": [],
|
||||
"unresolved": [],
|
||||
"untagged_payments": [
|
||||
10
|
||||
],
|
||||
"vendors": [
|
||||
{
|
||||
"decided": {
|
||||
"decided_by": "Riley Chen",
|
||||
"decided_on": "2026-01-05"
|
||||
},
|
||||
"decision": {
|
||||
"files": "misc"
|
||||
},
|
||||
"decision_needed": false,
|
||||
"decisions": [
|
||||
{
|
||||
"decision": {
|
||||
"files": "misc"
|
||||
},
|
||||
"effective": null,
|
||||
"source": {
|
||||
"decided_by": "Riley Chen",
|
||||
"decided_on": "2026-01-05"
|
||||
}
|
||||
}
|
||||
],
|
||||
"effective": null,
|
||||
"excluded_card": "0",
|
||||
"name": "Ace Rentals",
|
||||
"not_reportable": "0",
|
||||
"paid": "1200",
|
||||
"reportable": false,
|
||||
"status": "under_threshold",
|
||||
"tin_on_file": false,
|
||||
"undetermined": "0",
|
||||
"vendor_id": 2
|
||||
},
|
||||
{
|
||||
"decided": null,
|
||||
"decision": "undetermined",
|
||||
"decision_needed": true,
|
||||
"decisions": [],
|
||||
"effective": null,
|
||||
"excluded_card": "0",
|
||||
"name": "Bigco",
|
||||
"not_reportable": "0",
|
||||
"paid": "9000",
|
||||
"reportable": false,
|
||||
"status": "undetermined",
|
||||
"tin_on_file": false,
|
||||
"undetermined": "0",
|
||||
"vendor_id": 4
|
||||
},
|
||||
{
|
||||
"decided": {
|
||||
"decided_by": "Riley Chen",
|
||||
"decided_on": "2026-01-05"
|
||||
},
|
||||
"decision": {
|
||||
"files": "nec"
|
||||
},
|
||||
"decision_needed": false,
|
||||
"decisions": [
|
||||
{
|
||||
"decision": {
|
||||
"files": "nec"
|
||||
},
|
||||
"effective": null,
|
||||
"source": {
|
||||
"decided_by": "Riley Chen",
|
||||
"decided_on": "2026-01-05"
|
||||
}
|
||||
}
|
||||
],
|
||||
"effective": null,
|
||||
"excluded_card": "0",
|
||||
"name": "Dana",
|
||||
"not_reportable": "0",
|
||||
"paid": "2200",
|
||||
"reportable": true,
|
||||
"status": "reportable",
|
||||
"tin_on_file": true,
|
||||
"undetermined": "0",
|
||||
"vendor_id": 1
|
||||
},
|
||||
{
|
||||
"decided": {
|
||||
"decided_by": "Riley Chen",
|
||||
"decided_on": "2026-01-05"
|
||||
},
|
||||
"decision": {
|
||||
"files": "nec"
|
||||
},
|
||||
"decision_needed": false,
|
||||
"decisions": [
|
||||
{
|
||||
"decision": {
|
||||
"files": "nec"
|
||||
},
|
||||
"effective": null,
|
||||
"source": {
|
||||
"decided_by": "Riley Chen",
|
||||
"decided_on": "2026-01-05"
|
||||
}
|
||||
}
|
||||
],
|
||||
"effective": null,
|
||||
"excluded_card": "0",
|
||||
"name": "Sam",
|
||||
"not_reportable": "0",
|
||||
"paid": "0",
|
||||
"reportable": false,
|
||||
"status": "under_threshold",
|
||||
"tin_on_file": true,
|
||||
"undetermined": "0",
|
||||
"vendor_id": 3
|
||||
}
|
||||
],
|
||||
"year": 2026
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user