-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathleague_rules_test.go
42 lines (35 loc) · 991 Bytes
/
league_rules_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
package poeapi
import "testing"
func TestGetLeagueRules(t *testing.T) {
c := client{
host: testHost,
useSSL: false,
useCache: false,
limiter: newRateLimiter(UnlimitedRate, UnlimitedRate),
httpClient: testClient,
}
_, err := c.GetLeagueRules()
if err != nil {
t.Fatalf("failed to get league rules: %v", err)
}
}
func TestParseLeagueRulesResponse(t *testing.T) {
resp, err := loadFixture("fixtures/league-rules.json")
if err != nil {
t.Fatalf("failed to read fixture for league rules test: %v", err)
}
_, err = parseLeagueRulesResponse(resp)
if err != nil {
t.Fatalf("failed to parse league rules response: %v", err)
}
}
func TestParseLeagueRulesResponseWithInvalidJSON(t *testing.T) {
resp, err := loadFixture("fixtures/invalid.json")
if err != nil {
t.Fatalf("failed to read fixture for league rules test: %v", err)
}
_, err = parseLeagueRulesResponse(resp)
if err == nil {
t.Fatal("failed to detect invalid league rules json")
}
}