pure def has_free_shipping(order_total: Int) -> Bool {
return order_total >= 50
}
test "larger order qualifies" {
observe has_free_shipping(75) == True
}
Lesson 1 / free_shipping.vary
Run your first mutation pass
See that one happy-path test leaves most mutants alive.
vary mutate rewrites the implementation in small ways (flipping a comparison, returning a constant, dropping a statement) and checks whether the tests still pass. Each survivor is a place where the tests would not have noticed a bug. With one happy-path test the score is intentionally low.
vary mutate free_shipping.vary --tests free_shipping.vary --quick
Expected output
(?m)Mutation score: \d{1,2}%