Files
go-sip/internal/ai/current_media_profile_test.go
T

31 lines
982 B
Go

package ai
import (
"strings"
"testing"
)
func TestCurrentBindRejectsSampleRatesUnsupportedByAgentMedia(t *testing.T) {
for _, tc := range []struct {
name, mode, endpoint string
}{
{name: "ASR-only capture", mode: "asr_only", endpoint: "asr"},
{name: "full-AI capture", mode: "full_ai", endpoint: "asr"},
{name: "full-AI playback", mode: "full_ai", endpoint: "tts"},
} {
t.Run(tc.name, func(t *testing.T) {
task, providers := currentFixture(t, tc.mode)
task = changeCurrentAgent(t, task, func(agent map[string]any) {
if tc.endpoint == "asr" {
agent["asr"].(map[string]any)["input"].(map[string]any)["sample_rate_hz"] = 24000
} else {
agent["tts"].(map[string]any)["format"].(map[string]any)["sample_rate_hz"] = 24000
}
})
if _, err := BindCurrent(task, providers); err == nil || !strings.Contains(err.Error(), "media") {
t.Fatalf("SDK-supported sample rate cannot silently mismatch 16 kHz Agent media: %v", err)
}
})
}
}