forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(gov): add test for
Tally
function
Although rather complex, the `govKeeper.Tally` function has no unit tests. This change adds a test that covers around 91% of the code, only some unexpected errors are not covered. If this change is accepted, another will follow to refactor the function into smaller parts (without changing the test). This will address the TODO on top, reduce complexity, improve readability and reusability. This test should also help for issues like cosmos#11422 and cosmos#10353. It's more comfortable to improve performance or completely rewrite the implementation with a high code coverage. The `setupGovKeeper` had to be modified because it was registering some mocks expectations that cannot be overridden. It now takes an additional variadic argument that can be used to better customize the mocks expectations. Also, to improve readability, the mocks are all gathered in a new specific `mocks` struct.
- Loading branch information
Showing
6 changed files
with
480 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.