forked from blockfrost/blockfrost-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_block_test.go
111 lines (101 loc) · 2.74 KB
/
api_block_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package blockfrost_test
import (
"context"
"reflect"
"testing"
"github.com/blockfrost/blockfrost-go"
)
func TestResourceBlockLatest(t *testing.T) {
api := blockfrost.NewAPIClient(
blockfrost.APIClientOptions{},
)
got, err := api.BlockLatest(context.TODO())
testErrorHelper(t, err)
nullGot := blockfrost.Block{}
if reflect.DeepEqual(got, nullGot) {
t.Fatal("got null struct")
}
}
func TestResourceBlock(t *testing.T) {
hash := "b2466aac25c5d620fd99ae6e0faa72bec3acb9aeb29961363f464dab51b5ac05"
api := blockfrost.NewAPIClient(
blockfrost.APIClientOptions{},
)
got, err := api.Block(context.TODO(), hash)
testErrorHelper(t, err)
nullGot := blockfrost.Block{}
if reflect.DeepEqual(got, nullGot) {
t.Fatal("got null struct")
}
}
func TestResourceBlockBySlot(t *testing.T) {
slot := 30895909
api := blockfrost.NewAPIClient(
blockfrost.APIClientOptions{},
)
got, err := api.BlockBySlot(context.TODO(), slot)
testErrorHelper(t, err)
nullGot := blockfrost.Block{}
if reflect.DeepEqual(got, nullGot) {
t.Fatal("got null struct")
}
}
func TestResourceBlockBySlotAndEpoch(t *testing.T) {
slot := 106397
api := blockfrost.NewAPIClient(
blockfrost.APIClientOptions{},
)
got, err := api.BlocksBySlotAndEpoch(context.TODO(), slot, 297)
testErrorHelper(t, err)
nullGot := blockfrost.Block{}
if reflect.DeepEqual(got, nullGot) {
t.Fatal("got null struct")
}
}
func TestBlockLatestTransactionsIntegration(t *testing.T) {
api := blockfrost.NewAPIClient(
blockfrost.APIClientOptions{},
)
got, err := api.BlockLatestTransactions(context.TODO())
testErrorHelper(t, err)
nullGot := []blockfrost.Transaction{}
if reflect.DeepEqual(got, nullGot) {
t.Fatal("got null struct")
}
}
func TestBlockTransactions(t *testing.T) {
block := "4873401"
api := blockfrost.NewAPIClient(
blockfrost.APIClientOptions{},
)
got, err := api.BlockTransactions(context.TODO(), block)
testErrorHelper(t, err)
nullGot := []blockfrost.Transaction{}
if reflect.DeepEqual(got, nullGot) {
t.Fatal("got null struct")
}
}
func TestBlockNextIntegration(t *testing.T) {
hash := "5ea1ba291e8eef538635a53e59fddba7810d1679631cc3aed7c8e6c4091a516a"
api := blockfrost.NewAPIClient(
blockfrost.APIClientOptions{},
)
got, err := api.BlocksNext(context.TODO(), hash)
testErrorHelper(t, err)
nullGot := []blockfrost.Block{}
if reflect.DeepEqual(got, nullGot) {
t.Fatal("got null struct")
}
}
func TestBlockPreviousIntegration(t *testing.T) {
hash := "5ea1ba291e8eef538635a53e59fddba7810d1679631cc3aed7c8e6c4091a516a"
api := blockfrost.NewAPIClient(
blockfrost.APIClientOptions{},
)
got, err := api.BlocksPrevious(context.TODO(), hash)
testErrorHelper(t, err)
nullGot := []blockfrost.Block{}
if reflect.DeepEqual(got, nullGot) {
t.Fatal("got null struct")
}
}