Files
memby/server/internal/api/playback_subtitles_test.go
T
2026-07-29 15:26:55 +12:00

26 lines
686 B
Go

package api
import "testing"
func TestSubtitleMIME(t *testing.T) {
tests := map[string]string{
"srt": "application/x-subrip",
"subrip": "application/x-subrip",
"webvtt": "text/vtt",
"ass": "text/x-ssa",
"mov_text": "application/x-quicktime-tx3g",
"pgssub": "",
}
for codec, want := range tests {
if got := subtitleMIME(codec, ""); got != want {
t.Errorf("subtitleMIME(%q) = %q, want %q", codec, got, want)
}
}
}
func TestSubtitleMIMEFallsBackToDeliveryExtension(t *testing.T) {
if got := subtitleMIME("", "https://emby.example/subtitles/4/stream.vtt?api_key=x"); got != "text/vtt" {
t.Fatalf("subtitleMIME delivery fallback = %q", got)
}
}