forked from chithams/go-nist-beacon
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgonistbeacon_test.go
47 lines (41 loc) · 1.03 KB
/
gonistbeacon_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
package beacon
import (
"github.com/davecgh/go-spew/spew"
"testing"
"time"
)
func TestLastRecord(t *testing.T) {
resp, err := LastRecord()
if err != nil {
panic(err)
}
spew.Dump(resp)
}
//If if returns an error the test was a sucess, since there is no current record as new as now. If it fails, check if your system clock is running correctly
func TestCurrentRecord(t *testing.T) {
resp, err := NextRecord(time.Now())
if err == nil {
t.Fail()
}
spew.Dump(resp, err, time.Now().Unix())
resp, err = NextRecord(time.Now().AddDate(0, 0, -1))
if err != nil {
panic(err)
}
spew.Dump(resp)
}
func TestPreviousRecord(t *testing.T) {
resp, err := PreviousRecord(time.Now())
if err != nil {
panic(err)
}
spew.Dump(resp)
}
//If if returns an error the test was a sucess, since there is no next record to the latest one. If it fails, check if your system clock is running correctly
func TestNextRecord(t *testing.T) {
resp, err := NextRecord(time.Now())
if err == nil {
t.Fail()
}
spew.Dump(resp, err, time.Now().Unix())
}