2022-05-07 14:20:38 +02:00
|
|
|
package cic_net
|
|
|
|
|
|
|
|
import (
|
2022-05-08 12:55:27 +02:00
|
|
|
"github.com/lmittmann/w3"
|
2022-05-07 14:20:38 +02:00
|
|
|
"os"
|
2022-05-08 12:55:27 +02:00
|
|
|
"testing"
|
2022-05-07 14:20:38 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type tConfig struct {
|
|
|
|
rpcProvider string
|
|
|
|
tokenIndex string
|
2022-05-08 12:55:27 +02:00
|
|
|
privateKey string
|
2022-05-07 14:20:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var conf = &tConfig{
|
|
|
|
rpcProvider: os.Getenv("RPC_PROVIDER"),
|
|
|
|
tokenIndex: os.Getenv("TOKEN_INDEX"),
|
2022-05-08 12:55:27 +02:00
|
|
|
privateKey: os.Getenv("PRIVATE_KEY"),
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCicNet_Connect(t *testing.T) {
|
|
|
|
name := "Test RPC connection"
|
|
|
|
wantErr := false
|
|
|
|
|
|
|
|
t.Run(name, func(t *testing.T) {
|
|
|
|
cicnet, _ := NewCicNet(conf.rpcProvider, w3.A(conf.tokenIndex))
|
|
|
|
|
|
|
|
if err := cicnet.Close(); (err != nil) != wantErr {
|
|
|
|
t.Errorf("EntryCount() error = %v, wantErr %v", err, wantErr)
|
|
|
|
}
|
|
|
|
})
|
2022-05-07 14:20:38 +02:00
|
|
|
}
|