-
Notifications
You must be signed in to change notification settings - Fork 142
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
test : Use IsType assertions in test #1574
test : Use IsType assertions in test #1574
Conversation
WalkthroughThe modifications introduce the use of Changes
Related issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (3)
- node/full_node_test.go (1 hunks)
- node/light_client_test.go (2 hunks)
- node/node_test.go (1 hunks)
Additional comments: 3
node/light_client_test.go (1)
- 21-21: Adding the
require.IsType
assertion in theTestLightClient_Panics
function is a positive step towards ensuring that theln
object is indeed aLightNode
. This enhances the test's reliability by verifying the object's type before proceeding with the test logic. It's a good practice to include such type checks, especially in dynamic languages where type errors can otherwise go unnoticed until runtime.node/full_node_test.go (2)
- 30-31: The addition of the
require.IsType
assertion in theTestStartup
function is a good practice for ensuring that the node object is indeed aFullNode
. This type check enhances the test's reliability by verifying the object's type at the beginning of the test. It's a valuable addition to the testing suite, contributing to the overall robustness of the tests.- 38-38: Similarly, the inclusion of the
require.IsType
assertion in theTestMempoolDirectly
function is commendable. It ensures that the node object is of the correct type (FullNode
) before proceeding with the test logic. This type assertion is crucial for maintaining the integrity and reliability of the tests, especially when dealing with different node types.
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.
Thanks for the submission!
My comment applies to all the places where IsType
was used - you still need to remove type assertions, to be able to reach require.IsType
in case of an error.
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (3)
- node/full_node_test.go (1 hunks)
- node/light_client_test.go (2 hunks)
- node/node_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- node/full_node_test.go
- node/light_client_test.go
- node/node_test.go
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
461537f
to
610d617
Compare
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (3)
- node/full_node_test.go (1 hunks)
- node/light_client_test.go (2 hunks)
- node/node_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- node/full_node_test.go
- node/light_client_test.go
- node/node_test.go
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1574 +/- ##
==========================================
+ Coverage 50.23% 52.24% +2.01%
==========================================
Files 52 52
Lines 6762 5516 -1246
==========================================
- Hits 3397 2882 -515
+ Misses 3024 2308 -716
+ Partials 341 326 -15 ☔ View full report in Codecov by Sentry. |
Overview
closes : #1570
Checklist
Summary by CodeRabbit
require.IsType
in various test functions to check object types.TestStartup
andTestMempoolDirectly
to validate the type of the node object asFullNode
.TestLightClient_Panics
to verify the type ofln
.TestNewNode
to include assertions usingrequire.IsType
to validate the types of nodes created, specifically forLightNode
andFullNode
.