mirror of
https://github.com/grassrootseconomics/cic-go.git
synced 2024-11-21 21:56:45 +01:00
Mohamed Sohail
79634affb8
module: - cic-go packages: - cic/meta - cic/net other fixes: - nonce is now a settable value - package init outside test runner scope
33 lines
618 B
Go
33 lines
618 B
Go
package net
|
|
|
|
import (
|
|
"github.com/lmittmann/w3"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
type tConfig struct {
|
|
rpcProvider string
|
|
tokenIndex string
|
|
privateKey string
|
|
}
|
|
|
|
var conf = &tConfig{
|
|
rpcProvider: os.Getenv("RPC_PROVIDER"),
|
|
tokenIndex: os.Getenv("TOKEN_INDEX"),
|
|
privateKey: os.Getenv("PRIVATE_KEY"),
|
|
}
|
|
|
|
func TestCicNet_Connect(t *testing.T) {
|
|
name := "Test RPC connection"
|
|
wantErr := false
|
|
|
|
cicnet, _ := NewCicNet(conf.rpcProvider, w3.A(conf.tokenIndex))
|
|
|
|
t.Run(name, func(t *testing.T) {
|
|
if err := cicnet.Close(); (err != nil) != wantErr {
|
|
t.Errorf("EntryCount() error = %v, wantErr %v", err, wantErr)
|
|
}
|
|
})
|
|
}
|