forked from sgt-kabukiman/srapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariable_test.go
More file actions
56 lines (46 loc) · 1.55 KB
/
variable_test.go
File metadata and controls
56 lines (46 loc) · 1.55 KB
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
// Copyright (c) 2015, Sgt. Kabukiman | MIT licensed
package srapi
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestVariables(t *testing.T) {
seedID := "0789j6nw" // gta vc chaos% seed
seedVar, err := VariableByID(seedID)
Convey("Fetching variables by valid IDs", t, func() {
So(err, ShouldBeNil)
So(seedVar.ID, ShouldEqual, seedID)
So(seedVar.Name, ShouldEqual, "Seed")
So(seedVar.Scope.Type, ShouldEqual, "full-game")
So(seedVar.Scope.Level, ShouldBeEmpty)
So(seedVar.Mandatory, ShouldBeTrue)
So(seedVar.UserDefined, ShouldBeTrue)
So(seedVar.Obsoletes, ShouldBeTrue)
So(seedVar.Values.Choices, ShouldNotBeEmpty)
So(seedVar.Values.Default, ShouldBeEmpty)
So(seedVar.Links, ShouldNotBeEmpty)
})
Convey("Fetching variables by invalid IDs", t, func() {
variable, err := VariableByID("i_do_not_exist")
So(err, ShouldNotBeNil)
So(variable, ShouldBeNil)
})
Convey("Fetch the game the variable belongs to", t, func() {
game, err := seedVar.Game(NoEmbeds)
So(err, ShouldBeNil)
So(game, ShouldNotBeNil)
So(game.Names.International, ShouldEqual, "Grand Theft Auto: Vice City Chaos%")
})
Convey("Fetch the category the variable belongs to", t, func() {
category, err := seedVar.Category(NoEmbeds)
So(err, ShouldBeNil)
So(category, ShouldBeNil)
variable, err := VariableByID("5lyjm9l4") // "Charatcer" in CTR
So(err, ShouldBeNil)
So(variable, ShouldNotBeNil)
category, err = variable.Category(NoEmbeds)
So(err, ShouldBeNil)
So(category, ShouldNotBeNil)
So(category.Name, ShouldEqual, "Any%")
})
}