import pytest from fastapi.testclient import TestClient from warbler_cda.api.service import app client = TestClient(app) def test_synthesize_basic(): fragments = [ {"id": "frag1", "text": "The mitochondria is the powerhouse of the cell.", "heat": 0.8}, {"id": "frag2", "text": "Cells use mitochondria to generate energy.", "heat": 0.7}, {"id": "frag3", "text": "Energy production is vital for cell survival.", "heat": 0.6}, {"id": "frag4", "text": "ATP is produced in mitochondria.", "heat": 0.9}, {"id": "frag5", "text": "Mitochondria have their own DNA.", "heat": 0.5}, ] response = client.post("/synthesize", json={"fragments": fragments}) assert response.status_code == 200 data = response.json() assert "micro_summaries" in data assert "macro_distillations" in data assert "metrics" in data assert len(data["micro_summaries"]) >= 1 # Macro distillation may or may not be present depending on config