React · Exercise 1 of 5Next
Beginner
Your first two tests
The code has a Greeting component and the little test() / expect() helper used in this phase's examples.
Write two tests with the helper. The first renders <Greeting name="Asha" /> and checks that the heading's text is exactly Hello, Asha!. The second does the same for Ravi (Hello, Ravi!).
Find the heading with screen.getByRole("heading"), not with querySelector.
Both tests must print a ✓ line in the console and none may print ✗.
What Check tests
- At least two tests pass (two ✓ lines in the console)
- No test fails
- The heading is found with getByRole
- One test checks Ravi's greeting
- A greeting is on the page
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.