HomeChallengesRepsProblemsLeaderboardTake a challenge

Testing what you cannot see

The function returns nothing. Observe what it did instead.

Intermediate18 min on the clock5 graded checks · 100 pointsTests That Catch BugsPro
Graded by running your code against real cases.

What you build

  • Build a fake send that records what it was called with
  • Assert how many times it was called
  • Assert exactly what it was called with
  • Assert it stays silent when nothing qualifies

Done means

Your suite passes a correct alertLowStock and fails five that each get it subtly wrong.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else. Each one runs your code; it is not a search for keywords.

  1. It catches alerts going out for every item+20Standing in for the real thing
  2. It catches the threshold being off by one+25Standing in for the real thing
  3. It catches nothing being sent at all+20Standing in for the real thing
  4. It catches the same alert going twice+15Standing in for the real thing
  5. It catches the wrong thing being sent+20Standing in for the real thing

What it teaches

The rest of Tests That Catch Bugs