FoundationsYour first tests · 4 of 5about 15 min
Every combination of conditions
discountPercent(isMember, hasCoupon) combines two conditions. The rules for each combination are in the contract.
Write one test per combination. A bug that breaks a single row stays hidden unless a test lands exactly on that row.
Before this: Challenge: Break one rule at a time
Contract
/**
* Discount percentage for an order.
* - Member with a coupon: 15.
* - Member without a coupon: 10.
* - Non-member with a coupon: 5.
* - Non-member without a coupon: 0.
* @param {boolean} isMember
* @param {boolean} hasCoupon
* @returns {number}
*/
function discountPercent(isMember, hasCoupon)