package service import ( "context" "testing" ) func TestDashScopeRESTSTT_Transcribe_Success(t *testing.T) { client := NewDashScopeRESTSTT("test-key", "qwen3-asr-flash-2026-02-10") if !client.IsAvailable() { t.Error("client should be available when apiKey is set") } if client.Model() != "qwen3-asr-flash-2026-02-10" { t.Errorf("unexpected model: %s", client.Model()) } } func TestDashScopeRESTSTT_NotAvailable(t *testing.T) { client := NewDashScopeRESTSTT("", "") if client.IsAvailable() { t.Error("client should not be available without apiKey") } } func TestDashScopeRESTSTT_DefaultModel(t *testing.T) { client := NewDashScopeRESTSTT("key", "") if client.Model() != "qwen3-asr-flash-2026-02-10" { t.Errorf("expected default model, got %s", client.Model()) } } func TestDashScopeRESTSTT_Transcribe_NoAPIKey(t *testing.T) { client := NewDashScopeRESTSTT("", "") _, err := client.Transcribe(context.Background(), []byte{}, "wav", "zh") if err == nil { t.Error("expected error when API key is not configured") } } func TestDashScopeRESTSTT_GetStatus(t *testing.T) { client := NewDashScopeRESTSTT("key", "test-model") status := client.GetStatus() if status["available"] != true { t.Error("status should be available") } if status["model"] != "test-model" { t.Errorf("unexpected model in status: %v", status["model"]) } if status["protocol"] != "rest" { t.Errorf("unexpected protocol: %v", status["protocol"]) } }