-
Notifications
You must be signed in to change notification settings - Fork 10
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
[SC-437] Fixing coverage by adding unit tests #18
[SC-437] Fixing coverage by adding unit tests #18
Conversation
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.
Two small suggestions, other that that looks good.
test/CCTPReceiver.t.sol
Outdated
function test_handleReceiveMessage_success() public { | ||
assertEq(target.data(), 0); | ||
vm.prank(destinationMessenger); | ||
receiver.handleReceiveMessage( |
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.
May as well assert return value here
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.
added
test/IntegrationBase.t.sol
Outdated
@@ -105,6 +105,16 @@ abstract contract IntegrationBaseTest is Test { | |||
assertEq(moSource.length(), 2); | |||
assertEq(moSource.messages(0), 3); | |||
assertEq(moSource.messages(1), 4); | |||
|
|||
// One more message to destination |
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.
Don't we want another to source as well to make sure that both relays handle correctly?
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.
ya good point, added
test/CCTPReceiver.t.sol
Outdated
assertEq(result, true); | ||
assertEq(target.count(), 1); |
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.
Align
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.
done
Coverage after merging SC-437-fix-coverage into SC-452-refactor-forwards-receivers will be
Coverage Report
|
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
Adding unit tests to the receiver contracts for more robust testing and it fixes coverage issues.
Please note I also updated the import to relative to fix an issue with having this as a library. It wouldn't resolve the types properly otherwise.
Also, fixing a bug with subsequent message relays on all testing frameworks.