tiny-moon-labs / guard-free-shipping
PublicCommit
0897557#!/bin/sh
# The new offer promises free shipping from EUR 50.00, inclusive.
set -eu
failed=0
check_fee() {
if actual=$(sh shipping.sh "$1"); then
if [ "$actual" = "$2" ]; then
printf 'PASS cart EUR %s: shipping %s cents\n' "$3" "$actual"
return
fi
printf 'FAIL cart EUR %s: expected %s cents shipping, got %s\n' "$3" "$2" "$actual"
else
printf 'FAIL cart EUR %s: checkout did not return a fee\n' "$3"
fi
failed=1
}
check_fee 4999 499 49.99
check_fee 5000 0 50.00
check_fee 5001 0 50.01
exit "$failed"
