#!/usr/bin/env bash set -euo pipefail if [[ -z "${SAMPLE_CNI:-}" || -z "${FOLDER_HASH:-}" ]]; then echo "[SKIP] Définir SAMPLE_CNI et FOLDER_HASH pour exécuter ce test" exit 0 fi if [[ ! -f "$SAMPLE_CNI" ]]; then echo "[ERR] SAMPLE_CNI introuvable: $SAMPLE_CNI" >&2 exit 1 fi echo "[TEST] OCR CNI via /api/extract (folderHash=$FOLDER_HASH)" HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -F "document=@$SAMPLE_CNI" -F "folderHash=$FOLDER_HASH" http://localhost:3001/api/extract || true) if [[ "$HTTP_CODE" == "200" || "$HTTP_CODE" == "201" || "$HTTP_CODE" == "202" ]]; then echo "[OK] Extraction acceptée (HTTP $HTTP_CODE)" exit 0 else echo "[ERR] Extraction refusée (HTTP $HTTP_CODE)" >&2 exit 1 fi