-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for the claims controller #514
Conversation
Thanks for the contribution. @maurolacy could you review this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
A couple more checks, and we are good to merge.
assert_eq!(saved_claims.len(), 1); | ||
assert_eq!(saved_claims[0].amount, (TEST_AMOUNT + 100).into()); | ||
assert_eq!(saved_claims[0].release_at, Expiration::AtHeight(10)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to this, add a test where the cap allows to release only part of a claim (i.e. test_claim_tokens_with_cap_only_partial_amount_released()
).
Let's say you have a mature claim for 100, but cap is 75.
Confirm / check that claim amounts are properly adjusted, and completed claims are removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the code partial claims are not claimed at all. So in the case when the cap is less than either of the claims nothing will be claimed. Adding a test case based on that.
@maurolacy Fixed the tests! Thanks for taking a look. |
deps.as_mut().storage, | ||
&Addr::unchecked("addr"), | ||
&env.block, | ||
Some((TEST_AMOUNT - 50).into()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Added unit tests for all functions defined in the claims controller.