-
Notifications
You must be signed in to change notification settings - Fork 2
/
the_games_db_test.go
71 lines (64 loc) · 1.38 KB
/
the_games_db_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
package thegamesdb
import (
"testing"
)
func TestGetArt(t *testing.T) {
parameters := map[string]string{
"id": "2",
}
art, err := GetArt(parameters)
if err != nil {
t.Fatalf("%s", err.Error())
}
println(len(art.Images.Fanarts))
}
func TestGetPlatformGames(t *testing.T) {
parameters := map[string]string{
"platform": "1",
}
games, err := GetPlatformGames(parameters)
if err != nil {
t.Fatalf("%s", err.Error())
}
println(games.Games[0].Id)
}
func TestGetPlatformList(t *testing.T) {
parameters := map[string]string{}
platforms, err := GetPlatformsList(parameters)
if err != nil {
t.Fatalf("%s", err.Error())
}
println(platforms.PlatformTag.Platforms[0].Name)
}
func TestGetGamesList(t *testing.T) {
parameters := map[string]string{
"name": "Double Dragon",
}
games, err := GetGamesList(parameters)
if err != nil {
t.Fatalf("%s", err.Error())
}
println(len(games.Games))
println(games.Games[0].GameTitle)
println(games.Games[0].Platform)
}
func TestGetGame(t *testing.T) {
parameters := map[string]string{
"id": "2",
}
game, err := GetGame(parameters)
if err != nil {
t.Fatalf("%s", err.Error())
}
println(game.Game.GameTitle)
}
func TestGetPlatform(t *testing.T) {
parameters := map[string]string{
"id": "15",
}
platform, err := GetPlatform(parameters)
if err != nil {
t.Fatalf("%s", err.Error())
}
println(string(platform.Platform.Console))
}