FoundationsYour first tests · 1 of 5about 10 min

Test both sides of a rule

A sign-up form calls isAdult(age) to decide who may create an account. Write tests for it.

Your tests run twice: once against the correct code, where they must all pass, and once against each of three broken versions, where at least one test must fail. A test that passes no matter what the code does protects nothing.

The starter test passes, but it does not catch any of the bugs. Run it to see.

Before this: Guide: What to Test (and What Not To)

Contract

/**
 * Returns true when the person is an adult (18 or older), false otherwise.
 * @param {number} age  Whole years.
 * @returns {boolean}
 */
function isAdult(age)

Your tests