Test quality Recommended
Review tests like code
Review test code with the same care as production code. It must be clear, small and free of copy and paste.
How to do it
Check that each test name states a behaviour and that the setup is short. Share setup through factories and helpers, not copied blocks. Reject tests that only check that a mock was called with the code's own arguments.
How to check
The linter and type checker run on test files with the same settings as production code. A copy-and-paste detector, such as jscpd or PMD CPD, fails the check on duplicated blocks in tests. The code review questions cover the test files in every pull request.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers testing playbook: https://agentwranglers.se/playbook/testing/test-quality/review-tests.