diff --git a/scripts/smoke.sh b/scripts/smoke.sh index 573b37d..de13d2d 100755 --- a/scripts/smoke.sh +++ b/scripts/smoke.sh @@ -11,6 +11,12 @@ cd "$(dirname "$0")/.." addr=127.0.0.1:8099 pass=smoke + +# Dates are relative, never literal. A hardcoded one turns into "some day in +# the past" at the next midnight, and the assertions quietly start meaning +# something else. +d0=$(date +%F) +d1=$(date -d yesterday +%F) tmp=$(mktemp -d) trap 'kill ${srv:-0} 2>/dev/null || true; rm -rf "$tmp"' EXIT @@ -134,51 +140,53 @@ check "picking a dish opens the sides step" \ check "saving redirects back to the day" \ "$(curl -s -o /dev/null -w '%{http_code}' -u ":$pass" \ - -d "pvm=2026-09-05&ruoka=$ruoka" "http://$addr/kirjaa")" "303" + -d "pvm=$d0&ruoka=$ruoka" "http://$addr/kirjaa")" "303" check "the saved day shows what was eaten" \ - "$(curl -s -u ":$pass" "http://$addr/?pvm=2026-09-05")" "kirjattu" + "$(curl -s -u ":$pass" "http://$addr/?pvm=$d0")" "kirjattu" # The selected day expands inside the list rather than in a panel above it, # so the rows below do not shift when one is tapped. -day=$(curl -s -u ":$pass" "http://$addr/?pvm=2026-09-05") +day=$(curl -s -u ":$pass" "http://$addr/?pvm=$d0") check "the selected day expands in place" "$day" 'class="open"' check "and stays in the list rather than being lifted out" "$day" "kirjattu" # ---- the day list patches in place instead of navigating ---------------- -dayp=$(curl -s -u ":$pass" -H 'Datastar-Request: true' "http://$addr/paiva?pvm=2026-09-05") +dayp=$(curl -s -u ":$pass" -H 'Datastar-Request: true' "http://$addr/paiva?pvm=$d0") check "opening a day patches the list" "$dayp" 'id="paivat"' refute "and returns a fragment, not a page" "$dayp" "