Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The addition of
NewAccountWithAddress
andSetAccount
methods correctly addresses the issue of test accounts not being added to the account keeper, which was causing nil pointer dereferences. This change ensures that test accounts are properly initialized and set in the account keeper before being used in tests, thereby preventing the previously observed runtime errors.However, it's important to ensure that the
NewAccountWithAddress
method does not have side effects that could affect other tests or the overall test suite's behavior. Additionally, consider adding a check after setting the account to verify that it has been correctly added to the account keeper. This could further improve the robustness of the tests.Would you like me to provide an example of how to verify that accounts have been correctly added to the account keeper?
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.
All tests in the test suite are affected, now they pass. Before that they all failed.
Account is properly added to the keeper because all the tests passes. Why I should check that when the production code will failed if it is not. If we follow that logic we should check that account is fund correctly or that the context is properly created and so on.
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.
@EmilGeorgiev, thank you for your insight. You make a valid point about the balance between ensuring robustness and avoiding redundancy in tests. Given that all tests in the suite now pass, indicating that the accounts are properly added to the account keeper, it's reasonable to rely on these outcomes as confirmation of the accounts being correctly set up. Your approach highlights the importance of practicality in testing, ensuring that we focus on what truly matters for the integrity of the code without overcomplicating the test suite. I appreciate your perspective on this matter.