46 lines
951 B
Go
46 lines
951 B
Go
package api
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"strings"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestContinueWatchingRequestsEpisodeMetadata(t *testing.T) {
|
||
|
|
fields := strings.Split(fieldsContinue, ",")
|
||
|
|
want := []string{
|
||
|
|
"Overview",
|
||
|
|
"Genres",
|
||
|
|
"ProductionYear",
|
||
|
|
"OfficialRating",
|
||
|
|
"CommunityRating",
|
||
|
|
"RunTimeTicks",
|
||
|
|
"SeriesId",
|
||
|
|
"SeriesName",
|
||
|
|
"ParentIndexNumber",
|
||
|
|
"IndexNumber",
|
||
|
|
}
|
||
|
|
for _, field := range want {
|
||
|
|
if !fieldListContains(fields, field) {
|
||
|
|
t.Errorf("Continue Watching does not request %s", field)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestDetailRequestsEpisodeIdentity(t *testing.T) {
|
||
|
|
fields := strings.Split(fieldsDetail, ",")
|
||
|
|
for _, field := range []string{"SeriesId", "SeriesName", "ParentIndexNumber", "IndexNumber"} {
|
||
|
|
if !fieldListContains(fields, field) {
|
||
|
|
t.Errorf("item detail does not request %s", field)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func fieldListContains(values []string, target string) bool {
|
||
|
|
for _, value := range values {
|
||
|
|
if value == target {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return false
|
||
|
|
}
|