-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedsm_test.go
54 lines (50 loc) · 1.15 KB
/
edsm_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
package edsm
import (
"testing"
)
func TestSystem(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
srv := NewService(Test)
sys, err := srv.System("Beagle Point", SYSTEM_ALL)
if err != nil {
t.Error(err)
}
if sys == nil {
t.Fatal("cannot find Beagle Point in EDSM")
} else {
t.Log(sys)
}
}
func TestDiscard(t *testing.T) {
if testing.Short() {
t.Skip("skipped test in short mode")
}
srv := NewService(Test)
discs := []string{"-MUST GO AWAY-"}
err := srv.Discard(&discs)
if err != nil {
t.Error(err)
}
if len(discs) == 0 {
t.Fatal("suspicious: no event to discard")
}
for _, e := range discs {
if e == "-MUST GO AWAY-" {
t.Error("discard list did not overwrite")
}
t.Logf("discard: '%s'\n", e)
}
}
func TestJournal(t *testing.T) {
if testing.Short() {
t.Skip("skipped test in short mode")
}
srv := NewService(Test)
eventStr := `{ "timestamp":"2018-04-29T14:30:52Z", "event":"Cargo", "Inventory":[ { "Name":"drones", "Name_Localised":"Limpet", "Count":4, "Stolen":0 }, { "Name":"grain", "Count":1, "Stolen":0 } ] }`
err := srv.Journal("goEDSMc-Tester", eventStr)
if err != nil {
t.Fatal(err)
}
}