diff --git a/scripts/check-f3-1-web-contract.sh b/scripts/check-f3-1-web-contract.sh new file mode 100644 index 0000000..83acb70 --- /dev/null +++ b/scripts/check-f3-1-web-contract.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +LAYOUT="$ROOT/web-v2/src/layout/AppLayout.tsx" +APP="$ROOT/web-v2/src/app/App.tsx" +PAGE="$ROOT/web-v2/src/pages/InventoryCreatePage.tsx" + +for file in "$LAYOUT" "$APP" "$PAGE"; do + test -f "$file" || { + echo "F3.1 WEB contract: falta $file" + exit 1 + } +done + +if grep -Fq "label: 'Relevamientos'" "$LAYOUT"; then + echo "F3.1 WEB contract: Relevamientos no debe volver al menĂº principal" + exit 1 +fi + +grep -Fq 'path="/relevamiento/*"' "$APP" +grep -Fq 'Navigate to="/inventarios" replace' "$APP" +grep -Fq 'path="/inventarios/nuevo"' "$APP" +grep -Fq 'InventoryCreatePage' "$APP" + +for kind in AREA YACIMIENTO INSTALACION SUBINSTALACION; do + grep -Fq "kind: '$kind'" "$PAGE" +done + +if grep -Fq "kind: 'EQUIPO'" "$PAGE"; then + echo "F3.1 WEB contract: el alta guiada no debe restaurar EQUIPO como quinto nivel estructural" + exit 1 +fi + +grep -Fq 'getInventoryFamilyFindings' "$PAGE" + +echo 'F3.1 WEB contract: OK'