-
Notifications
You must be signed in to change notification settings - Fork 0
/
team_test.go
139 lines (136 loc) · 3.43 KB
/
team_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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
package yfquery
import "testing"
func TestTeamsQuery(t *testing.T) {
testQueries(t,
[]testQueryPair{
{
Teams(),
"/teams",
},
{
Teams().Keys([]string{"nba.l.12345.t.1", "nba.l.12345.t.2"}),
"/teams;team_keys=nba.l.12345.t.1,nba.l.12345.t.2",
},
{
Teams().Key("nba.l.12345.t.1"),
"/teams;team_keys=nba.l.12345.t.1",
},
{
Teams().Key("nba.l.12345.t.1").Key("nba.l.12345.t.2"),
"/teams;team_keys=nba.l.12345.t.2",
},
{
Teams().Key("nba.l.12345.t.1").Roster(),
"/teams;team_keys=nba.l.12345.t.1/roster",
},
{
Teams().Key("nba.l.12345.t.1").AllMatchups(),
"/teams;team_keys=nba.l.12345.t.1/matchups",
},
{
Teams().Key("nba.l.12345.t.1").Matchups([]int{1, 5}),
"/teams;team_keys=nba.l.12345.t.1/matchups;weeks=1,5",
},
{
Teams().Key("nba.l.12345.t.1").Roster().AllMatchups(),
"/teams;team_keys=nba.l.12345.t.1;out=roster,matchups",
},
{
Teams().Key("nba.l.12345.t.1").DraftResults(),
"/teams;team_keys=nba.l.12345.t.1/draftresults",
},
{
Teams().Key("nba.l.12345.t.1").RecommendedTradePartners(),
"/teams;team_keys=nba.l.12345.t.1/recommended_trade_partners",
},
{
Teams().Key("nba.l.12345.t.1").PositionalRanks(),
"/teams;team_keys=nba.l.12345.t.1/positional_ranks",
},
{
Teams().Key("nba.l.12345.t.1").Standings(),
"/teams;team_keys=nba.l.12345.t.1/standings",
},
{
Teams().Key("nba.l.12345.t.1").StatsWithDefaults(),
"/teams;team_keys=nba.l.12345.t.1/stats",
},
{
Teams().Key("nba.l.12345.t.1").Stats().LastWeek(),
"/teams;team_keys=nba.l.12345.t.1/stats;type=lastweek",
},
{
Teams().Key("nba.l.12345.t.1").RosterWeek(3),
"/teams;team_keys=nba.l.12345.t.1/roster;week=3",
},
{
Teams().Key("nba.l.12345.t.1").RosterDay("2006-10-06"),
"/teams;team_keys=nba.l.12345.t.1/roster;date=2006-10-06",
},
})
}
func TestTeamQuery(t *testing.T) {
testQueries(t,
[]testQueryPair{
{
Team(),
"/team",
},
{
Team().Key("nba.l.12345.t.1"),
"/team/nba.l.12345.t.1",
},
{
Team().Key("nba.l.12345.t.1").Key("nba.l.12345.t.2"),
"/team/nba.l.12345.t.2",
},
{
Team().Key("nba.l.12345.t.1").Roster(),
"/team/nba.l.12345.t.1/roster",
},
{
Team().Key("nba.l.12345.t.1").AllMatchups(),
"/team/nba.l.12345.t.1/matchups",
},
{
Team().Key("nba.l.12345.t.1").Matchups([]int{1, 5}),
"/team/nba.l.12345.t.1/matchups;weeks=1,5",
},
{
Team().Key("nba.l.12345.t.1").Roster().AllMatchups(),
"/team/nba.l.12345.t.1;out=roster,matchups",
},
{
Team().Key("nba.l.12345.t.1").DraftResults(),
"/team/nba.l.12345.t.1/draftresults",
},
{
Team().Key("nba.l.12345.t.1").RecommendedTradePartners(),
"/team/nba.l.12345.t.1/recommended_trade_partners",
},
{
Team().Key("nba.l.12345.t.1").PositionalRanks(),
"/team/nba.l.12345.t.1/positional_ranks",
},
{
Team().Key("nba.l.12345.t.1").Standings(),
"/team/nba.l.12345.t.1/standings",
},
{
Team().Key("nba.l.12345.t.1").StatsWithDefaults(),
"/team/nba.l.12345.t.1/stats",
},
{
Team().Key("nba.l.12345.t.1").Stats().LastWeek(),
"/team/nba.l.12345.t.1/stats;type=lastweek",
},
{
Team().Key("nba.l.12345.t.1").RosterWeek(3),
"/team/nba.l.12345.t.1/roster;week=3",
},
{
Team().Key("nba.l.12345.t.1").RosterDay("2006-10-06"),
"/team/nba.l.12345.t.1/roster;date=2006-10-06",
},
})
}