@@ -0,0 +1,53 @@
|
||||
package laosijiser
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"91porn-server/common/laosiji"
|
||||
)
|
||||
|
||||
func TestMovieH265SourceURL(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
links []laosiji.LinkInfo
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "empty",
|
||||
links: []laosiji.LinkInfo{
|
||||
{Hevc_m3u8_url: " "},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "does not mix a later episode with first H264 link",
|
||||
links: []laosiji.LinkInfo{
|
||||
{Hevc_m3u8_url: ""},
|
||||
{Hevc_m3u8_url: "https://cdn.example.com/m3m/movie/hevc.m3u8?token=ignored"},
|
||||
{Hevc_m3u8_url: "other.m3u8"},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "first link normalized",
|
||||
links: []laosiji.LinkInfo{
|
||||
{Hevc_m3u8_url: "https://cdn.example.com/m3m/movie/hevc.m3u8?token=ignored"},
|
||||
{Hevc_m3u8_url: "other.m3u8"},
|
||||
},
|
||||
want: "laosiji/m3m/movie/hevc.m3u8",
|
||||
},
|
||||
{
|
||||
name: "already normalized",
|
||||
links: []laosiji.LinkInfo{
|
||||
{Hevc_m3u8_url: "laosiji/rk130/hevc/movie/index.m3u8"},
|
||||
},
|
||||
want: "laosiji/rk130/hevc/movie/index.m3u8",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
if got := movieH265SourceURL(test.links); got != test.want {
|
||||
t.Fatalf("movieH265SourceURL() = %q, want %q", got, test.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user