Files
corescope-voices/tests/run.sh
T
richandClaude Opus 5.5 6dc4592ed2 Initial voice pack: seven live-map voices for CoreScope
Voices taken from CoreScope feat/audio-voices (ac257569), plus a compat
shim for stock audio.js, an idempotent install/uninstall script, a
derived-image Dockerfile, and tests that run against a real public/ dir.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 14:39:51 -04:00

30 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# End-to-end test of install.sh against a real CoreScope public/ directory.
#
# tests/run.sh <path/to/corescope/public>
#
# Works on a temporary copy; the directory you pass is never modified.
set -eu
[ $# -eq 1 ] || { echo "usage: $0 <corescope public dir>" >&2; exit 2; }
HERE=$(cd "$(dirname "$0")/.." && pwd)
WORK=$(mktemp -d)
trap 'rm -rf "$WORK"' EXIT
cp -R "$1" "$WORK/public"
cp "$WORK/public/index.html" "$WORK/index.orig.html"
fail() { echo "FAIL: $*" >&2; exit 1; }
sh "$HERE/install.sh" "$WORK/public" >/dev/null
sh "$HERE/install.sh" "$WORK/public" >/dev/null # re-run must not duplicate
n=$(grep -c 'audio-v2-metal.js' "$WORK/public/index.html")
[ "$n" -eq 1 ] || fail "expected 1 metal <script> tag after two installs, got $n"
echo " ok install is idempotent"
node "$HERE/tests/smoke.js" "$WORK/public"
sh "$HERE/install.sh" --uninstall "$WORK/public" >/dev/null
cmp -s "$WORK/index.orig.html" "$WORK/public/index.html" || fail "uninstall did not restore index.html"
[ ! -e "$WORK/public/audio-v2-metal.js" ] || fail "uninstall left voice files behind"
echo " ok uninstall restores the original"