tvdb - series_test.go
1 package tvdb_test
2
3 import "testing"
4
5 func TestActors(t *testing.T) {
6 t.Parallel()
7 tests := []struct {
8 ShowID uint64
9 ActorIDs []uint64
10 }{
11 {
12 71326,
13 []uint64{
14 8704,
15 8705,
16 8706,
17 8707,
18 8708,
19 8709,
20 8710,
21 },
22 },
23 {
24 78131,
25 []uint64{
26 61837,
27 61838,
28 61839,
29 61840,
30 61841,
31 61842,
32 61843,
33 },
34 },
35 }
36
37 for n, test := range tests {
38 actors, err := conn.Actors(test.ShowID)
39 if err != nil {
40 t.Errorf("test %d: unexpected error: %s", n+1, err)
41 continue
42 }
43 Loop:
44 for _, actorID := range test.ActorIDs {
45 for _, actor := range actors {
46 if actorID == actor.ID {
47 continue Loop
48 }
49 }
50 t.Errorf("test %d: failed to find actor ID %d", n+1, actorID)
51 }
52 }
53 }
54
55 func TestEpisodes(t *testing.T) {
56 t.Parallel()
57 tests := []struct {
58 ShowID uint64
59 EpisodeIDs []uint64
60 }{
61 {
62 80383,
63 []uint64{
64 335586,
65 335587,
66 335588,
67 335589,
68 335590,
69 335591,
70 },
71 },
72 {
73 78131,
74 []uint64{
75 272769,
76 272775,
77 272784,
78 272791,
79 272770,
80 272776,
81 272785,
82 272792,
83 272771,
84 272777,
85 272786,
86 272793,
87 272772,
88 272778,
89 272787,
90 272794,
91 272773,
92 272779,
93 272788,
94 272795,
95 272774,
96 272780,
97 272789,
98 272796,
99 272781,
100 272790,
101 272782,
102 272783,
103 },
104 },
105 }
106
107 for n, test := range tests {
108 episodes, err := conn.Episodes(test.ShowID, 0)
109 if err != nil {
110 t.Errorf("test %d: unexpected error: %s", n+1, err)
111 continue
112 }
113 Loop:
114 for _, episodeID := range test.EpisodeIDs {
115 for _, episode := range episodes {
116 if episodeID == episode.ID {
117 continue Loop
118 }
119 }
120 t.Errorf("test %d: failed to find episode ID %d", n+1, episodeID)
121 }
122 }
123 }