go-whisper-api/api/result_test.go
admin b5c083e06f
Some checks failed
CodeQL / Analyze (go) (push) Successful in 6m28s
Docker Image / build-docker (push) Failing after 13m26s
Lint and Testing / lint (push) Successful in 11m17s
Lint and Testing / test (push) Successful in 11m17s
Lint and Testing / golangci (push) Successful in 2m40s
first commit
2026-06-04 18:10:52 +07:00

27 lines
805 B
Go

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"])
}
}