Skip to main content

Wallet System — Test Cases

Feature version: v1.0
Reference doc: Finance System
Result notation: ✅ Pass | ❌ Fail | ⏭ Skip | 🐛 Fail + bug report


Changelog

DateVersionChangeAuthor
2026-05-10v1.0Initial creation

TC-WALLET-001 — Master Wallet 🆕 NEW

Precondition: Ability to create accounts and access the DB to verify.

#DescriptionStepsExpected ResultActual Result
1Each account has exactly one master walletCreate a new player → Check the wallets tableExactly one record with (owner_type='player', owner_id=<id>)
2Initial balance is 0Create a new account → Check balance fieldsbalance = 0, reservedBalance = 0
3Default wallet status is activeCreate a new account → Check the status fieldstatus = 'active'
4Duplicate master wallet is rejectedInsert a duplicate (owner_type, owner_id) row into the DBUnique constraint error

TC-WALLET-002 — USD Wallet (Shop / Agent) 🆕 NEW

Precondition: Shop and Player accounts exist for comparison.

#DescriptionStepsExpected ResultActual Result
1Shop has a USD walletCreate a new Shop → Check usd_wallets tableUSD wallet record exists for the Shop
2Agent has a USD walletCreate a new Agent → Check usd_wallets tableUSD wallet record exists for the Agent
3Player does not have a USD walletCheck usd_wallets where owner_type='player'No records found
4balanceGross and balanceNet update correctly on player depositPlayer deposits → Check Shop USD walletbalanceGross 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.

#DescriptionStepsExpected ResultActual Result
1One game wallet per (player, game provider)Player deposits into a game for the first time → Check user_game_walletsExactly one record with (userId, gameProviderId)
2Initial syncStatus is correctCheck immediately after game wallet is createdsyncStatus = 'never_synced' or 'pending'
3walletBalance and inGameBalance match after successful syncDeposit into game → Wait for async sync to completewalletBalance == inGameBalance, syncStatus = 'in_sync'
4walletBalance and inGameBalance may diverge while sync is pendingCreate a deposit, check immediately before sync finisheswalletBalance > 0; inGameBalance may still be 0 or stale
5No duplicate game wallet for the same (userId, gameProviderId)Deposit into the same game twiceStill only one record in user_game_wallets; balance is accumulated