Testingbeginner
Rename tests to follow 'should...when...' convention
Test Naming Fixer
Rename tests to follow 'should...when...' convention
Rename tests to follow consistent naming conventions.
Instructions
- Scan all test files for inconsistent naming:
grep -rn "it(\|test(" tests/ --include="*.test.*"
- Apply the
should [expected behavior] when [condition]pattern:
Before → After:
"login test" → "should redirect to dashboard when credentials are valid"
"handles empty array" → "should return empty result when input array is empty"
"createUser" → "should create user with default role when role not specified"
"error case" → "should throw ValidationError when email is invalid"
"it works" → "should return computed total when given valid line items"
- Fix describe block naming:
// Bad: describe('tests')
// Good: describe('UserService') or describe('POST /api/users')
- Search and replace across all test files.
Rules
describe: name of the unit being tested (class, function, endpoint)it/test:should [verb] [expected] when [condition]- No implementation details in test names — describe behavior