Add tests for withdraw functionality in StreamContract#114
Add tests for withdraw functionality in StreamContract#114ogazboiz merged 3 commits intoLabsCrypt:mainfrom
Conversation
ogazboiz
left a comment
There was a problem hiding this comment.
Great addition of tests for the withdraw functionality. This is much needed. Approving and merging.
|
@ogazboiz merge it |
|
i have fix the issue @ogazboiz |
ogazboiz
left a comment
There was a problem hiding this comment.
These two test lines are a very small addition. To make this PR merge-worthy, please consider: 1) Adding at least a few more test cases for the withdraw flow (e.g. unauthorized withdraw, withdraw more than deposited), and 2) Rebasing on latest main which has seen significant changes since this PR was opened.
ogazboiz
left a comment
There was a problem hiding this comment.
These test lines are a small but good start. To make this ready for merge, please consider adding a few more test cases for the withdraw flow (e.g., edge cases like unauthorized access or over-withdrawal) and rebasing on the latest main branch.
This pull request enhances the test coverage #82 the
StreamContractby adding tests for thewithdrawfunction, specifically focusing on authorization scenarios. The new tests ensure that only authorized recipients can successfully withdraw from a stream, and that unauthorized attempts are properly rejected.Authorization testing:
withdraw_succeeds_for_authorized_recipienttest to verify that a recipient with proper authorization can successfully withdraw from a stream and that the authorization is correctly recorded. (contracts/stream_contract/src/test.rs)withdraw_fails_for_non_recipient_and_authorized_call_still_succeedstest to confirm that unauthorized users cannot withdraw, and that an authorized recipient can still withdraw after a failed unauthorized attempt. (contracts/stream_contract/src/test.rs)Test utility improvements:
MockAuthandMockAuthInvokefor simulating contract authorization in tests, improving the realism and robustness of test scenarios. (contracts/stream_contract/src/test.rs)Closes #82