Wallet System — Test Cases
Feature version: v1.0
Reference doc: Finance System
Result notation: ✅ Pass | ❌ Fail | ⏭ Skip | 🐛 Fail + bug report
Changelog
| Date | Version | Change | Author |
|---|---|---|---|
| 2026-05-10 | v1.0 | Initial creation | — |
TC-WALLET-001 — Master Wallet 🆕 NEW
Precondition: Ability to create accounts and access the DB to verify.
| # | Description | Steps | Expected Result | Actual Result |
|---|---|---|---|---|
| 1 | Each account has exactly one master wallet | Create a new player → Check the wallets table | Exactly one record with (owner_type='player', owner_id=<id>) | |
| 2 | Initial balance is 0 | Create a new account → Check balance fields | balance = 0, reservedBalance = 0 | |
| 3 | Default wallet status is active | Create a new account → Check the status field | status = 'active' | |
| 4 | Duplicate master wallet is rejected | Insert a duplicate (owner_type, owner_id) row into the DB | Unique constraint error |
TC-WALLET-002 — USD Wallet (Shop / Agent) 🆕 NEW
Precondition: Shop and Player accounts exist for comparison.
| # | Description | Steps | Expected Result | Actual Result |
|---|---|---|---|---|
| 1 | Shop has a USD wallet | Create a new Shop → Check usd_wallets table | USD wallet record exists for the Shop | |
| 2 | Agent has a USD wallet | Create a new Agent → Check usd_wallets table | USD wallet record exists for the Agent | |
| 3 | Player does not have a USD wallet | Check usd_wallets where owner_type='player' | No records found | |
| 4 | balanceGross and balanceNet update correctly on player deposit | Player deposits → Check Shop USD wallet | balanceGross increases by full USD; balanceNet = balanceGross − fee |
TC-WALLET-003 — Game Wallet (Player) 🆕 NEW
Precondition: A player account exists and at least one game provider is active.
| # | Description | Steps | Expected Result | Actual Result |
|---|---|---|---|---|
| 1 | One game wallet per (player, game provider) | Player deposits into a game for the first time → Check user_game_wallets | Exactly one record with (userId, gameProviderId) | |
| 2 | Initial syncStatus is correct | Check immediately after game wallet is created | syncStatus = 'never_synced' or 'pending' | |
| 3 | walletBalance and inGameBalance match after successful sync | Deposit into game → Wait for async sync to complete | walletBalance == inGameBalance, syncStatus = 'in_sync' | |
| 4 | walletBalance and inGameBalance may diverge while sync is pending | Create a deposit, check immediately before sync finishes | walletBalance > 0; inGameBalance may still be 0 or stale | |
| 5 | No duplicate game wallet for the same (userId, gameProviderId) | Deposit into the same game twice | Still only one record in user_game_wallets; balance is accumulated |