-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdbn_scanner_test.go
44 lines (37 loc) · 1.02 KB
/
dbn_scanner_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
package dbn_test
import (
"os"
"testing"
"github.com/NimbleMarkets/dbn-go"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
// Test Launcher
func TestDbn(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "dbn-go suite")
}
var _ = Describe("DbnScanner", func() {
Context("v1 files", func() {
It("should read a v1 test file correctly", func() {
file, err := os.Open("./tests/data/test_data.ohlcv-1s.v1.dbn")
Expect(err).To(BeNil())
defer file.Close()
records, metadata, err := dbn.ReadDBNToSlice[dbn.OhlcvMsg](file)
Expect(err).To(BeNil())
Expect(metadata).ToNot(BeNil())
Expect(len(records)).To(Equal(2))
})
})
Context("v2 files", func() {
It("should read a v2 test file correctly", func() {
file, err := os.Open("./tests/data/test_data.ohlcv-1s.dbn")
Expect(err).To(BeNil())
defer file.Close()
records, metadata, err := dbn.ReadDBNToSlice[dbn.OhlcvMsg](file)
Expect(err).To(BeNil())
Expect(metadata).ToNot(BeNil())
Expect(len(records)).To(Equal(2))
})
})
})