-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathendpoints_test.go
123 lines (106 loc) · 4.9 KB
/
endpoints_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
package raideriogo
import "testing"
func TestEndpointCharacter(t *testing.T) {
expectedURL := [...]string{
"https://raider.io/api/v1/characters/profile?region=testRegion&realm=testRealm&name=testName",
"https://raider.io/api/v1/characters/profile?region=testRegion&realm=testRealm&name=testName&fields=gear,guild,mythic_plus_scores",
}
if EndpointCharacter("testRegion", "testRealm", "testName", "") != expectedURL[0] {
t.Fatal("String mismatch.")
}
if EndpointCharacter("testRegion", "testRealm", "testName", "gear,guild,mythic_plus_scores") != expectedURL[1] {
t.Fatal("String mismatch.")
}
}
func TestEndpointGuild(t *testing.T) {
expectedURL := [...]string{
"https://raider.io/api/v1/guilds/profile?region=testRegion&realm=testRealm&name=testName",
"https://raider.io/api/v1/guilds/profile?region=testRegion&realm=testRealm&name=testName&fields=raid_progression,raid_rankings",
}
if EndpointGuild("testRegion", "testRealm", "testName", "") != expectedURL[0] {
t.Fatal("String mismatch.")
}
if EndpointGuild("testRegion", "testRealm", "testName", "raid_progression,raid_rankings") != expectedURL[1] {
t.Fatal("String mismatch.")
}
}
func TestEndpointMythicPlusAffixes(t *testing.T) {
expectedURL := [...]string{
"https://raider.io/api/v1/mythic-plus/affixes?region=testRegion",
"https://raider.io/api/v1/mythic-plus/affixes?region=testRegion&locale=us",
}
if EndpointMythicPlusAffixes("testRegion", "") != expectedURL[0] {
t.Fatal("String mismatch.")
}
if EndpointMythicPlusAffixes("testRegion", "us") != expectedURL[1] {
t.Fatal("String mismatch.")
}
}
func TestEndpointMythicPlusRuns(t *testing.T) {
expectedURL := [...]string{
"https://raider.io/api/v1/mythic-plus/runs",
"https://raider.io/api/v1/mythic-plus/runs?season=season-7.3.0",
"https://raider.io/api/v1/mythic-plus/runs?season=season-7.3.0®ion=us",
"https://raider.io/api/v1/mythic-plus/runs?season=season-7.3.0®ion=us&dungeon=eye-of-azshara",
"https://raider.io/api/v1/mythic-plus/runs?season=season-7.3.0®ion=us&dungeon=eye-of-azshara&affixes=bolstering",
}
if EndpointMythicPlusRuns("", "", "", "") != expectedURL[0] {
t.Fatal("String mismatch.")
}
if EndpointMythicPlusRuns("season-7.3.0", "", "", "") != expectedURL[1] {
t.Fatal("String mismatch.")
}
if EndpointMythicPlusRuns("season-7.3.0", "us", "", "") != expectedURL[2] {
t.Fatal("String mismatch.")
}
if EndpointMythicPlusRuns("season-7.3.0", "us", "eye-of-azshara", "") != expectedURL[3] {
t.Fatal("String mismatch.")
}
if EndpointMythicPlusRuns("season-7.3.0", "us", "eye-of-azshara", "bolstering") != expectedURL[4] {
t.Fatal("String mismatch.")
}
}
func TestEndpointRaidingBossRankings(t *testing.T) {
expectedURL := [...]string{
"https://raider.io/api/v1/raiding/boss-rankings?raid=tomb-of-sargeras&boss=goroth&difficulty=mythic®ion=us",
"https://raider.io/api/v1/raiding/boss-rankings?raid=tomb-of-sargeras&boss=goroth&difficulty=mythic®ion=us&realm=earthen-ring",
"https://raider.io/api/v1/raiding/boss-rankings?raid=tomb-of-sargeras&boss=goroth&difficulty=mythic®ion=us&realm=connected-earthen-ring",
}
if EndpointRaidingBossRankings("tomb-of-sargeras", "goroth", "mythic", "us", "") != expectedURL[0] {
t.Fatal("String mismatch.")
}
if EndpointRaidingBossRankings("tomb-of-sargeras", "goroth", "mythic", "us", "earthen-ring") != expectedURL[1] {
t.Fatal("String mismatch.")
}
if EndpointRaidingBossRankings("tomb-of-sargeras", "goroth", "mythic", "us", "connected-earthen-ring") != expectedURL[2] {
t.Fatal("String mismatch.")
}
}
func TestEndpointRaidingHallOfFame(t *testing.T) {
var expectedURL = "https://raider.io/api/v1/raiding/hall-of-fame?raid=tomb-of-sargeras&difficulty=mythic®ion=us"
if EndpointRaidingHallOfFame("tomb-of-sargeras", "mythic", "us") != expectedURL {
t.Fatal("String mismatch.")
}
}
func TestEndpointRaidingProgression(t *testing.T) {
var expectedURL = "https://raider.io/api/v1/raiding/progression?raid=tomb-of-sargeras&difficulty=mythic®ion=us"
if EndpointRaidingProgression("tomb-of-sargeras", "mythic", "us") != expectedURL {
t.Fatal("String mismatch.")
}
}
func TestEndpointRaidingRaidRankings(t *testing.T) {
expectedURL := [...]string{
"https://raider.io/api/v1/raiding/raid-rankings?raid=tomb-of-sargeras&difficulty=mythic®ion=us",
"https://raider.io/api/v1/raiding/raid-rankings?raid=tomb-of-sargeras&difficulty=mythic®ion=us&realm=earthen-ring",
"https://raider.io/api/v1/raiding/raid-rankings?raid=tomb-of-sargeras&difficulty=mythic®ion=us&realm=connected-earthen-ring",
}
if EndpointRaidingRaidRankings("tomb-of-sargeras", "mythic", "us", "") != expectedURL[0] {
t.Fatal("String mismatch.")
}
if EndpointRaidingRaidRankings("tomb-of-sargeras", "mythic", "us", "earthen-ring") != expectedURL[1] {
t.Fatal("String mismatch.")
}
if EndpointRaidingRaidRankings("tomb-of-sargeras", "mythic", "us", "connected-earthen-ring") != expectedURL[2] {
t.Fatal("String mismatch.")
}
}