test: Unit-Tests für normalizeForComparison, parseVerdict, parseBlockers

28 Tests für die drei reinen Hilfsfunktionen aus pi-coder-judge-extension.ts.
run-tests.sh führt test-utils.ts ohne ts-node aus (sed-basiertes TS→JS-Stripping).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-05-29 18:14:03 +02:00
commit 7b13c4996d
2 changed files with 220 additions and 0 deletions

27
run-tests.sh Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Unit-Tests für pi-coder-judge-extension.ts
# Keine Abhängigkeiten außer node — entfernt TypeScript-Annotationen on-the-fly.
set -euo pipefail
TS_FILE="$(dirname "$0")/test-utils.ts"
if ! command -v node &>/dev/null; then
echo "❌ node nicht gefunden" >&2
exit 1
fi
# TypeScript-Annotationen entfernen: `: string`, `: unknown`, `: void`, `: boolean`
# und `function f(a: T, b: T)` → `function f(a, b)` (einfache Parameterlisten)
node --input-type=module < <(
sed \
-e 's/: string\b//g' \
-e 's/: unknown\b//g' \
-e 's/: void\b//g' \
-e 's/: boolean\b//g' \
-e 's/: number\b//g' \
-e 's/(s: )/(s)/g' \
-e 's/(text: )/(text)/g' \
-e 's/(actual, expected: unknown, label: string)/( actual, expected, label)/g' \
"$TS_FILE"
)