diff --git a/scripts/git-hooks/pre-commit b/scripts/git-hooks/pre-commit index ff710bd..9014a4e 100755 --- a/scripts/git-hooks/pre-commit +++ b/scripts/git-hooks/pre-commit @@ -43,3 +43,18 @@ if has_staged_match '^client/scripts/.*\.gd$'; then exit 1 fi fi + +# Enforce explicit AAA markers in changed C# test files. +for f in "${staged_files[@]}"; do + if [[ ! "$f" =~ ^server/NeonSprawl\.Server\.Tests/.*Tests\.cs$ ]]; then + continue + fi + if [[ ! -f "$f" ]]; then + continue + fi + if ! rg -q 'Arrange' "$f" || ! rg -q 'Act' "$f" || ! rg -q 'Assert' "$f"; then + echo "pre-commit: $f is missing explicit AAA markers (Arrange/Act/Assert)." >&2 + echo "Add clear Arrange/Act/Assert sections in changed C# tests." >&2 + exit 1 + fi +done