-
-
Notifications
You must be signed in to change notification settings - Fork 31
Update unit test naming guidelines #134
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
Open
NicolasMassart
wants to merge
10
commits into
main
Choose a base branch
from
update_test_naming
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
de1d430
to
d4bb6cb
Compare
Mrtenz
reviewed
Mar 7, 2025
mcmire
reviewed
Mar 7, 2025
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.
Pull Request Overview
This PR updates our unit test naming guidelines to improve clarity and maintainability of our test suite.
- Added a structured set of instructions for naming tests using active verbs.
- Included new examples of both poor ("Don't") and good ("Do") naming practices.
- Provided an extended list of considerations to ensure test names are descriptive and concise.
Comments suppressed due to low confidence (1)
docs/testing/unit-testing.md:125
- [nitpick] The test name in this example includes the 'should' prefix even though the guidelines recommend avoiding it. Consider revising the test name to remove the 'should' prefix and focus directly on the behavior.
it('should successfully add token when address is valid and decimals are set and symbol exists', () => {
avoid confusion as when I asked to use the 3rd person form for verb, this doesn't apply to "render" in "render matches snapshot" as render is not the verb here but a noun. The verb is match which is correct here as "matches". So they replaced the correct phrase by "renders matches snapshot" which is wrong. Remove render to avoid verb/noun confusion and anyway, render is obvious and part of the test implementation
hieu-w
reviewed
Jun 11, 2025
…ions - Break up test naming examples into pairs with explanations - Add example for missing/unclear test descriptions - Clarify error-related test naming (be specific about error types) - Update snapshot test naming to 'matches rendered snapshot' - Remove vague terms like 'gracefully' and 'handles' from examples - Enhance guidance to avoid weasel words and subjective language
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Test Naming Guidelines Update
Updates our test naming conventions to improve clarity and maintainability of our test suite.
Key Changes
Note
Overhauls unit testing guidelines with clearer naming conventions, scenario grouping, isolation practices, and snapshot usage, adding concise rules and expanded examples.
docs/testing/unit-testing.md
describe
usage (by function and scenario) andit
descriptions with action-oriented, behavior-focused phrasing; de-emphasizes “should”.resetMocks
,restoreMocks
), handling globals via spies/wrappers/DI, and replacing shared vars with factories.beforeEach
in favor of setup helpers/wrappers; includes teardown pattern.Written by Cursor Bugbot for commit f9e4a92. This will update automatically on new commits. Configure here.