This commit is contained in:
jose-rZM
2025-12-15 11:42:17 +01:00
commit c3f7af7379
33 changed files with 5004 additions and 0 deletions

36
backend/tests/test_api.py Normal file
View File

@@ -0,0 +1,36 @@
from fastapi.testclient import TestClient
from app.main import app
client = TestClient(app)
def test_health():
response = client.get("/health")
assert response.status_code == 200
body = response.json()
assert body["status"] == "ok"
def test_menu_contains_fish():
response = client.get("/menu")
assert response.status_code == 200
body = response.json()
mains = [main.lower() for main in body["mains"]]
assert any("pescado" in main for main in mains)
assert body["menu_price"] == 5.5
deal = body["university_deal"]
assert deal["old_price"] == 4.5
assert deal["current_price"] == 5.5
def test_prices_random_list():
response = client.get("/prices")
assert response.status_code == 200
body = response.json()
items = body["items"]
assert isinstance(items, list)
assert len(items) >= 1
first = items[0]
assert "item" in first and "price" in first and "currency" in first
assert all(item["price"] <= 3 for item in items)