Test Cases: Expenses
| Module | CORE-12 | URD | Expenses URD |
|---|
Status honesty: automatic posting (P1) is verified in code. Account management, the manual draft→issue lifecycle, transfers, and several safeguards (amount validation, transaction-level access control, shift cash movements) are partially built or pending. Cases for those areas are marked accordingly and called out in §3 Traceability.
1. Coverage Summary
| Area | URD reqs | Test cases | Covered |
|---|---|---|---|
Accounts (WAL) | 6 | 6 | ⚠️ partial |
Vouchers & posting (VCH) | 12 | 12 | ⚠️ partial |
Ledger lines (TXN) | 4 | 4 | ✅ |
Categories (CAT) | 4 | 4 | ✅ |
2. Test Cases
TC-<AREA>-NNNlines up withURD-<AREA>-NNN. Priority = P1 (critical) / P2 (major) / P3 (minor).
2.1 Accounts (WAL)
| TC ID | URD ref | Scenario | Steps | Expected | P |
|---|---|---|---|---|---|
| TC-WAL-001 | URD-WAL-001 | Create accounts of each type | 1. Create a Cash, Bank, QR, and Mobile-POS account | All four accounts exist, owned by the merchant | P1 |
| TC-WAL-002 | URD-WAL-002 | One default per type | 1. Mark a Bank account as default 2. Mark a second Bank account as default | Only one Bank account stays default for the merchant | P1 |
| TC-WAL-003 | URD-WAL-003 | New merchant gets accounts | 1. Create a new merchant | Default accounts plus internal Inventory and Cost-of-Goods-Sold accounts are seeded | P1 |
| TC-WAL-004 | URD-WAL-004 | Balance moves with postings | 1. Note an account balance 2. Issue a receipt voucher to it | Balance increases by the voucher amount | P1 |
| TC-WAL-005 | URD-WAL-005 | Account currency | 1. Create an account without specifying currency | Account currency defaults to VND | P3 |
| TC-WAL-006 | URD-WAL-006 | Merchant-scoped visibility | 1. As an owner of Merchant B, list accounts | Only Merchant B's accounts are returned; Merchant A's are not | P1 |
2.2 Vouchers & posting (VCH)
| TC ID | URD ref | Scenario | Steps | Expected | P |
|---|---|---|---|---|---|
| TC-VCH-001 | URD-VCH-001 | Voucher types | 1. Issue a receipt, a payment, a transfer, and an adjustment | All four voucher types are recorded | P1 |
| TC-VCH-002 | URD-VCH-002 | Balanced voucher | 1. Issue a transfer voucher | Total debit equals total credit | P1 |
| TC-VCH-003 | URD-VCH-003 | Auto receipt on paid sale | 1. Pay a sale order | A receipt voucher is issued, classified Sale, linked to the order; account balance up | P1 |
| TC-VCH-004 | URD-VCH-004 | Auto payment on PO receipt | 1. Receive a purchase order | A payment voucher is issued to the vendor, linked to the PO | P1 |
| TC-VCH-005 | URD-VCH-005 | Auto stock posting | 1. Sell stock (cost basis > 0) 2. Adjust stock | Cost-of-goods and adjustment vouchers post to internal control accounts | P1 |
| TC-VCH-006 | URD-VCH-006 | Idempotent re-delivery | 1. Replay the same sale-payment event | No duplicate voucher is created | P1 |
| TC-VCH-007 | URD-VCH-007 | Source linkage | 1. Inspect an auto-issued voucher | It references its source document (sale order / PO / stock movement) | P1 |
| TC-VCH-008 | URD-VCH-008 | Voucher numbering | 1. Issue several vouchers of one type in a month | Each gets a sequential number per merchant/type/month | P2 |
| TC-VCH-009 | URD-VCH-009 | Draft then issue | 1. Create a draft voucher 2. Approve/issue it | Draft becomes issued; a draft can be deleted before issue | P2 |
| TC-VCH-010 | URD-VCH-010 | Transfer between accounts | 1. Transfer amount A → B | A goes down, B goes up by the same amount; one balanced transfer voucher | P2 |
| TC-VCH-011 | URD-VCH-011 | Void by reversal | 1. Void an issued voucher | A balanced reversal posts; original preserved; balances restored | P2 |
| TC-VCH-012 | URD-VCH-012 | Shift attribution | 1. Record a pay-in/out against a POS session | Voucher is attributed to the shift session | P3 |
2.3 Ledger lines (TXN)
| TC ID | URD ref | Scenario | Steps | Expected | P |
|---|---|---|---|---|---|
| TC-TXN-001 | URD-TXN-001 | Debit/credit lines | 1. Inspect a voucher's lines | Lines are debit or credit against accounts | P1 |
| TC-TXN-002 | URD-TXN-002 | Line carries balance snapshot | 1. Inspect a posted line | It carries account, optional category, amount, and balance-before/after | P1 |
| TC-TXN-003 | URD-TXN-003 | Currency consistency | 1. Inspect a voucher's lines | All lines share the voucher's currency | P2 |
| TC-TXN-004 | URD-TXN-004 | Line source reference | 1. Inspect an auto-posted line | It references its source document | P3 |
2.4 Categories (CAT)
| TC ID | URD ref | Scenario | Steps | Expected | P |
|---|---|---|---|---|---|
| TC-CAT-001 | URD-CAT-001 | Seeded categories | 1. List system categories | 14 seeded categories exist across income and expense | P1 |
| TC-CAT-002 | URD-CAT-002 | Category typing | 1. Inspect categories | Each is typed income or expense | P1 |
| TC-CAT-003 | URD-CAT-003 | Auto category on auto voucher | 1. Pay a sale 2. Receive a PO | Receipt is classified Sale; PO payment uses the Purchase category | P1 |
| TC-CAT-004 | URD-CAT-004 | Custom child category | 1. Add a custom category under a parent | Custom category is created, nested under the parent, scoped to the merchant | P2 |
3. Traceability
Every Must requirement must map to ≥1 test case. Status reflects what is verified in code today versus pending.
| URD requirement | Test case(s) | Status |
|---|---|---|
| URD-WAL-001 | TC-WAL-001 | ⚠️ Account types verified in model; create-UI emerging |
| URD-WAL-002 | TC-WAL-002 | ✅ Covered (unique default index) |
| URD-WAL-003 | TC-WAL-003 | ✅ Covered (merchant-CDC reconciliation) |
| URD-WAL-004 | TC-WAL-004 | ✅ Covered (balance maintained per posting) |
| URD-WAL-005 | TC-WAL-005 | ✅ Covered (currency defaults to VND) |
| URD-WAL-006 | TC-WAL-006 | ⚠️ Enforced on accounts; transactions/categories controllers less restricted |
| URD-VCH-001 | TC-VCH-001 | ✅ Covered |
| URD-VCH-002 | TC-VCH-002 | ✅ Covered (balance assertion, 1e-4 tolerance) |
| URD-VCH-003 | TC-VCH-003 | ✅ Covered |
| URD-VCH-004 | TC-VCH-004 | ✅ Covered |
| URD-VCH-005 | TC-VCH-005 | ✅ Covered |
| URD-VCH-006 | TC-VCH-006 | ✅ Covered (per-event / per-source dedup indexes) |
| URD-VCH-007 | TC-VCH-007 | ✅ Covered |
| URD-VCH-008 | TC-VCH-008 | ✅ Covered (per merchant/type/month sequence) |
| URD-VCH-009 | TC-VCH-009 | ⚠️ Engine supports draft→issue; merchant UI emerging |
| URD-VCH-010 | TC-VCH-010 | ⚠️ Transfer voucher type supported; transfer UI emerging |
| URD-VCH-011 | TC-VCH-011 | ✅ Covered (void = balanced reversal) |
| URD-VCH-012 | TC-VCH-012 | ⚠️ Pending — shift cash movements not yet wired |
| URD-TXN-001 | TC-TXN-001 | ✅ Covered |
| URD-TXN-002 | TC-TXN-002 | ✅ Covered |
| URD-TXN-003 | TC-TXN-003 | ✅ Covered |
| URD-TXN-004 | TC-TXN-004 | ✅ Covered |
| URD-CAT-001 | TC-CAT-001 | ✅ Covered (14 seeded) |
| URD-CAT-002 | TC-CAT-002 | ✅ Covered |
| URD-CAT-003 | TC-CAT-003 | ✅ Covered |
| URD-CAT-004 | TC-CAT-004 | ✅ Covered |
Known limitations (from QE assessment)
Verified against code; folded here instead of being described as shipped behavior.
| Area | Gap |
|---|---|
| Amount validation | The ledger does not constrain amount sign/zero at the persistence layer; UI-level validation is the safeguard |
| Access control depth | Account listing is merchant-scoped; transaction and category endpoints are less restricted than accounts |
| Shift cash movements | Pay-in / pay-out / safe-drop attribution (URD-VCH-012) is not yet wired end to end |
| Status-history audit | Voucher lifecycle has issue/void audit fields, but a full status-change history table is not provided |
The older module test-cases described a "Draft → Finalized → Voided expense" lifecycle and
URD-ENT/LIF/REC/AUDrequirement codes that never matched the built finance model. Those have been retired in favour of the verified accounts / vouchers / ledger / categories model above.