-
Notifications
You must be signed in to change notification settings - Fork 2
/
hyper_test.go
52 lines (47 loc) · 1.26 KB
/
hyper_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
package hypersyncgo
import (
"context"
"github.com/enviodev/hypersync-client-go/options"
"github.com/enviodev/hypersync-client-go/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
"testing"
)
func TestHyperSync(t *testing.T) {
testCases := []struct {
name string
opts options.Options
networkId utils.NetworkID
addresses []common.Address
}{{
name: "Test Hyper Ethereum Client",
opts: options.Options{
LogLevel: zap.DebugLevel,
Blockchains: []options.Node{
{
Type: utils.EthereumNetwork,
NetworkId: utils.EthereumNetworkID,
Endpoint: "https://eth.hypersync.xyz",
RpcEndpoint: "https://eth.rpc.hypersync.xyz",
},
},
},
networkId: utils.EthereumNetworkID,
addresses: []common.Address{
common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7"),
},
}}
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
hsClient, err := NewHyper(ctx, testCase.opts)
require.NoError(t, err)
require.NotNil(t, hsClient)
client, found := hsClient.GetClient(testCase.networkId)
require.True(t, found)
require.NotNil(t, client)
})
}
}