-
Notifications
You must be signed in to change notification settings - Fork 0
/
game_test.go
107 lines (104 loc) · 2.16 KB
/
game_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package yfquery
import "testing"
func TestGameQueryCollection(t *testing.T) {
testQueries(t,
[]testQueryPair{
{
Games(),
"/games",
},
{
Games().IsAvailable(),
"/games;is_available=1",
},
{
Games().Types([]string{"full", "pickem-team"}),
"/games;game_types=full,pickem-team",
},
{
Games().Codes([]string{"nba", "nhl", "nfl"}),
"/games;game_codes=nba,nhl,nfl",
},
{
Games().Seasons([]int{2022}),
"/games;seasons=2022",
},
{
Games().Keys([]string{"223", "224"}),
"/games;game_keys=223,224",
},
{
Games().Key("223"),
"/games;game_keys=223",
},
{
Games().Key("223").Key("224"),
"/games;game_keys=224",
},
{
Games().Key("nba").RosterPositions(),
"/games;game_keys=nba/roster_positions",
},
{
Games().Key("nba").GameWeeks(),
"/games;game_keys=nba/game_weeks",
},
{
Games().Key("nba").PositionTypes(),
"/games;game_keys=nba/position_types",
},
{
Games().Key("nba").StatCategories(),
"/games;game_keys=nba/stat_categories",
},
{
Games().Key("nba").StatCategories().RosterPositions(),
"/games;game_keys=nba;out=stat_categories,roster_positions",
},
{
Games().IsAvailable().Codes([]string{"nba"}).Seasons([]int{2022, 2021}).Types([]string{"full"}).Keys([]string{"223"}),
"/games;game_keys=223;is_available=1;game_codes=nba;seasons=2022,2021;game_types=full",
},
})
}
func TestGameQueryResource(t *testing.T) {
testQueries(t,
[]testQueryPair{
{
Game(),
"/game",
},
{
Game().Key("nba"),
"/game/nba",
},
{
Game().Key("nba").Leagues(),
"/game/nba/leagues",
},
{
Game().Key("nba").Teams(),
"/game/nba/teams",
},
{
Game().Key("nba").RosterPositions(),
"/game/nba/roster_positions",
},
{
Game().Key("nba").GameWeeks(),
"/game/nba/game_weeks",
},
{
Game().Key("nba").PositionTypes(),
"/game/nba/position_types",
},
{
Game().Key("nba").StatCategories(),
"/game/nba/stat_categories",
},
{
Game().Key("nba").StatCategories().RosterPositions(),
"/game/nba;out=stat_categories,roster_positions",
},
})
}