forked from bitfinexcom/bitfinex-api-go
/
stats_test.go
39 lines (34 loc) · 817 Bytes
/
stats_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
package bitfinex
import (
"bytes"
"io/ioutil"
"net/http"
"testing"
)
func TestStatsAll(t *testing.T) {
httpDo = func(req *http.Request) (*http.Response, error) {
msg := `[{
"period":1,
"volume":"7967.96766158"
},{
"period":7,
"volume":"55938.67260266"
},{
"period":30,
"volume":"275148.09653645"
}]`
resp := http.Response{
Body: ioutil.NopCloser(bytes.NewBufferString(msg)),
StatusCode: 200,
}
return &resp, nil
}
stats, err := NewClient().Stats.All("btcusd", "10", "")
if err != nil {
t.Error(err)
}
if len(stats) != 3 {
t.Error("Expected", 3)
t.Error("Actual ", len(stats))
}
}