diff --git a/backend/tests/test_api.py b/backend/tests/test_api.py index 3a47f10..4cbb309 100644 --- a/backend/tests/test_api.py +++ b/backend/tests/test_api.py @@ -34,3 +34,24 @@ def test_prices_random_list(): first = items[0] assert "item" in first and "price" in first and "currency" in first assert all(item["price"] <= 3 for item in items) + + +def test_build_history(): + response = client.get("/builds") + assert response.status_code == 200 + body = response.json() + builds = body["builds"] + assert isinstance(builds, list) + assert len(builds) >= 1 + + first = builds[0] + assert "number" in first and "status" in first and "branch" in first + + # Ensure descending order by build number + numbers = [build["number"] for build in builds] + assert numbers == sorted(numbers, reverse=True) + + failed_builds = [build for build in builds if build["status"] == "failed"] + if failed_builds: + failed = failed_builds[0] + assert "failed_stage" in failed and "fun_message" in failed