package api import "testing" func TestSprResultReady(t *testing.T) { body := sprResultReady(TaskParams{ ID: "701b3e84-5815-4baf-97a2-933ff820f16d", Created: "2026-06-03 10:06:35", Processed: "2026-06-03 10:07:48", Status: "ready", Model: "common", Text: "hello", }) for _, key := range []string{"model", "text", "words", "toxicity", "emotion", "voice_analysis", "status", "taskID", "created", "processed"} { if body[key] == nil { t.Fatalf("missing %q", key) } } if body["status"] != "ready" { t.Fatalf("status=%v", body["status"]) } tox, ok := body["toxicity"].(map[string]float64) if !ok || len(tox) != 4 { t.Fatalf("toxicity=%v", body["toxicity"]) } }