FoundationsYour first tests · 3 of 5about 15 min

Break one rule at a time

isValidPassword(password) enforces three rules. A bug that drops one rule is invisible if every invalid password you test breaks several rules at once.

Write tests where each invalid password breaks exactly one rule, plus a valid password that sits right on the length boundary.

Before this: Guide: What to Test (and What Not To), Challenge: Every boundary, including zero

Contract

/**
 * A password is valid when ALL of these hold:
 * - it has at least 8 characters,
 * - it contains at least one digit (0-9),
 * - it contains at least one letter (a-z or A-Z).
 * @param {string} password
 * @returns {boolean}
 */
function isValidPassword(password)

Your tests