26 lines
686 B
Go
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)
|
|
}
|
|
}
|