Challenge: fix this empty value test bug

There can be subtle bugs in your tests when you use matchers like .toBeDefined() without considering how they handle different "falsy" values.

Your challenge: Review the provided function and its tests. The tests currently pass, but they shouldn't. The assertions don't match the actual function behaviour.

Your task is to identify why the test passes despite the mismatch and fix the test (do not modify the function itself).

i
Challenge Mode: This lesson is actually a challenge - you are given a half working test and have to figure out how to get it working correctly.

You can use our courses to learn how to solve this challenge - there are courses on everything from basic Jest/Vitest fundamentals, down to how to test frontend code (using React Testing Library).

Loading full lesson content & code...

Ready to try running tests for this lesson?