How to write unit-tests for substrate#3
How to write unit-tests for substrate#3Niraj-Kamdar wants to merge 1 commit intoframe-system-custom-configfrom
Conversation
There was a problem hiding this comment.
Hey @Niraj-Kamdar - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 3 issues found
- 🟢 Complexity: all looks good
- 🟢 Docstrings: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
| pub type MinimumBalance = <Runtime as pallet_balances::Config>::ExistentialDeposit; | ||
| } | ||
|
|
||
| #[cfg(test)] |
There was a problem hiding this comment.
suggestion (testing): Consider adding edge case tests for balance transfers.
It's great to see tests for normal balance transfer scenarios. However, adding tests for edge cases, such as transferring balance when the sender does not have enough funds or transferring a zero balance, would enhance the robustness of the test suite.
| pub type MinimumBalance = <Runtime as pallet_balances::Config>::ExistentialDeposit; | ||
| } | ||
|
|
||
| #[cfg(test)] |
There was a problem hiding this comment.
suggestion (testing): Add tests for error conditions in balance transfers.
Testing successful balance transfers is crucial, but it's equally important to verify the system's behavior under error conditions. For instance, tests that verify the system's response when attempting to transfer more than the account's balance or to an invalid account would be valuable.
| pub type MinimumBalance = <Runtime as pallet_balances::Config>::ExistentialDeposit; | ||
| } | ||
|
|
||
| #[cfg(test)] |
There was a problem hiding this comment.
suggestion (testing): Include tests for block number increments.
The current test suite checks the block number's set and get functionality but does not cover scenarios where the block number increments over time or through specific actions. Including such tests could provide more insights into the system's behavior over time.
|
This is really interesting and helpful. Thanks! |
No description provided.