Mistake: Meaningless Test Name
Find the Mistake Easy
Question
What is wrong with this test name?
Code
test('test1', () => {
expect(add(2, 3)).toBe(5);
});
Hint
The test name should describe what is being tested.
Explanation
The mistake is using a meaningless test name 'test1'. When this test fails, the name gives no clue about what broke. The fix: use a descriptive name that explains the behavior being tested: test('add returns the sum of two positive numbers', () => { ... });. Good test names serve as documentation.
Related Resources
Related Lessons
- Test Best Practices
Writing maintainable tests.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.