Align API error envelopes
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled

This commit is contained in:
Codex
2026-06-18 02:04:31 +02:00
parent 694913a280
commit 7adcdd76c7
8 changed files with 160 additions and 16 deletions
@@ -0,0 +1,22 @@
from __future__ import annotations
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
def test_frontend_api_client_accepts_top_level_error_contract() -> None:
client = (ROOT / "frontend" / "src" / "services" / "api" / "client.ts").read_text(encoding="utf-8")
assert 'typeof payload?.error === "string"' in client
assert "payload?.message" in client
assert "payload?.details" in client
def test_frontend_api_client_remains_legacy_error_tolerant() -> None:
client = (ROOT / "frontend" / "src" / "services" / "api" / "client.ts").read_text(encoding="utf-8")
assert "legacyError?.code" in client
assert "legacyError?.message" in client
assert "legacyError?.details" in client