Game Wallet & Sync — Test Cases
Feature version: v1.0
Reference doc: Deposit Technical Reference — Game Wallet Sync
Result notation: ✅ Pass | ❌ Fail | ⏭ Skip | 🐛 Fail + bug report
Changelog
| Date | Version | Change | Author |
|---|---|---|---|
| 2026-05-10 | v1.0 | Initial creation | — |
TC-GAMEWALLET-001 — Two-phase DB transaction sync 🆕 NEW
Precondition: A direct-to-game transaction is in
pendingstate. The game provider API is operational.
| # | Description | Steps | Expected Result | Actual Result |
|---|---|---|---|---|
| 1 | Transaction 1: lock + set status to processing | Monitor DB when sync begins | GameWalletTransaction.status = 'processing' | |
| 2 | External API succeeds → Transaction 2 completes | Game API returns success | status = 'completed'; walletBalance updated correctly | |
| 3 | External API fails → failed in a separate transaction | Simulate game API error | GameWalletTransaction → 'failed' (separate DB transaction; Txn 1 is not rolled back) | |
| 4 | Balance changes between Txn 1 and Txn 2 → Txn 2 aborts | Modify walletBalance after Txn 1 lock is released | Txn 2 detects inconsistency → does not commit | |
| 5 | Idempotency — sync triggered twice | Call processSingleGameWalletTransactionSync() a second time for the same transaction | No double-credit (second call is skipped by idempotency guard) |
TC-GAMEWALLET-002 — syncStatus flow 🆕 NEW
| # | Description | Steps | Expected Result | Actual Result |
|---|---|---|---|---|
| 1 | Wallet-only deposit has syncStatus = 'none' | Complete a deposit with no game selected | Transaction syncStatus = 'none' | |
| 2 | Direct-to-game: correct status progression | Complete a direct-to-game deposit and successful sync | syncStatus: none → pending → in_progress → completed | |
| 3 | Retry increments retryCount | Sync fails → retry worker picks it up | retryCount increments; nextRetryAt is set for the next attempt | |
| 4 | Persistent game API errors → failed | Simulate continuous game provider API errors | syncStatus = 'failed' after all retry attempts |