Fill: test() Function
Fill in the Blank Beginner
Question
Fill in the blank to create a valid Jest test:
Code
___('adds numbers', () => {
expect(1 + 1).toBe(2);
});
Hint
The function is named after what you're writing — a test.
Explanation
The correct answer is test. In Jest, test(name, callback) defines a test case. The first argument is a descriptive string, and the second is a function containing the test logic. it() is an alias for test() and would also work.
Related Resources
Related Lessons
- Jest Basics
Getting started with Jest.
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.