feat: add comprehensive user balance management tests#212
Conversation
|
@Gbangbolaoluwagbemiga Please resolve the conflicts |
|
@greatest0fallt1me, please review and merge, will appreciate picking up more issues, love the codebase and isea behind this |
19af03b to
0802906
Compare
|
@Gbangbolaoluwagbemiga Please resolve the conflicts |
|
@greatest0fallt1me conflicts resolved |
|
@greatest0fallt1me cli build issues has been fixed too, please leave a good review. Ready to take on more issues. |
|
@Gbangbolaoluwagbemiga, please check if the pipeline is failing. |
c903882 to
d51a73b
Compare
|
@Gbangbolaoluwagbemiga Please resolve the conflicts |
- Resolved conflicts in admin.rs, lib.rs, markets.rs, test.rs - Added global warning suppressions to fix compilation errors - Fixed duplicate test definitions - Ensured admin permissions logic logic is correct
1 similar comment
|
@greatest0fallt1me , I am so sorry for the late checks....Issue has been resolved. Will appreciate giving a compliment after merging...thank you fam |
|
@Gbangbolaoluwagbemiga pipeline failed |
- Add validate_balance_amount and validate_sufficient_balance to InputValidator - Add emit_balance_changed to EventEmitter - Make TokenTest.token_id public for test access - Fix balance management integration issues
2ff908b to
2bb9df2
Compare
- Merge balance management errors (renumber InsufficientBalance to 112, FundsLocked to 113) - Keep all test module declarations - Use upstream's automatic payout distribution and checked arithmetic - Fix events.rs to add emit_balance_changed properly - Add type annotation to total_distributed - Make TokenTest.token_id public for balance tests
- Replace crate::errors::Error:: with Error:: since Error is already imported - Fixes compilation error: 'could not find Error in errors' - Addresses CI build failure in job 62058616055
- Reduce errors.rs variant count by removing unused errors (IntegerOverflow, IntegerUnderflow, FundsLocked, DisputeTimeoutExpired) - Restore missing Balance struct and ReflectorAsset impl in types.rs - Fix trait bounds in events.rs by cloning data - Replace IntegerOverflow usage with InvalidInput in storage.rs - Add match arms for InsufficientBalance in errors.rs
- Add explicit lifetime to get_token_client return type in markets.rs - Add explicit lifetime to client() helper in bet_tests.rs and property_based_tests.rs - Make TokenTest struct public in test.rs to allow usage in other test modules - Fixes CI build failure due to lifetime confusion and private type exposure
- Initialize token contract and set TokenID in storage for event management tests - Mint tokens for test users to allow voting/betting - Fixes 'Error(Contract, Predictify-org#400)' (InvalidState) panic in tests requiring token operations
|
@greatest0fallt1me , pipeline issue resolved will appreciate some compliments fam and would love to pick more issues |
feature:Insufficient Event Metadata in refund_withdrawn
This PR implements comprehensive test cases for the User Balance Management system, targeting 95%+ coverage for deposits, withdrawals, and claims. It also updates the voting logic to production standards by enabling live token transfers.
Key Changes
New Tests: Added 24 test cases in test.rs covering:
Voting deposits and balance tracking.
Winnings claims and fee calculations.
Security validation (preventing double claims, unauthorized access).
Edge cases (zero balance, minimum stakes).
Bug Fix: Fixed test_claim_losing_outcome to correctly verify that losing claims are marked as processed.
Screenshot
Setup
Run tests with: cargo test --lib
Issue Linked
Closes #207