-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathraid_test.go
32 lines (26 loc) · 883 Bytes
/
raid_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
package raiderio_test
import (
"testing"
"github.com/tmaffia/raiderio"
)
func TestGetRaidBySlug(t *testing.T) {
testCases := []struct {
slug string
expectedName string
expectedErrMsg string
}{
{slug: "aberrus-the-shadowed-crucible", expectedName: "Aberrus, the Shadowed Crucible"},
{slug: "invalid raid slug", expectedErrMsg: "invalid raid"},
{slug: "aberrus-the-shadowed-crucibleinvalid raid slug", expectedErrMsg: "invalid raid"},
}
raids, _ := c.GetRaids(defaultCtx, raiderio.Expansions.Dragonflight)
for _, tc := range testCases {
raid, err := raids.GetRaidBySlug(tc.slug)
if err != nil && err.Error() != tc.expectedErrMsg {
t.Fatalf("expected error: %v, got: %v", tc.expectedErrMsg, err.Error())
}
if err == nil && raid.Name != tc.expectedName {
t.Fatalf("expected raid name: %v, got: %v", tc.expectedName, raid.Name)
}
}
}