-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathconfig_test.go
46 lines (39 loc) · 1.36 KB
/
config_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
package client_test
import (
"math"
"math/big"
"time"
"github.com/ethereum/go-ethereum/core/types"
. "github.com/stretchr/testify/assert"
"github.com/synapsecns/sanguine/core/testsuite"
"github.com/synapsecns/sanguine/ethergo/chain/client"
"github.com/synapsecns/sanguine/ethergo/mocks"
"gotest.tools/assert"
)
// TestConfigFromID makes sure configs are properly returned by id.
func (c ClientSuite) TestConfigFromID() {
// make sure all current configs are properly returned
for _, chainConfig := range client.ChainConfigs {
res := client.ConfigFromID(chainConfig.ChainID)
assert.DeepEqual(c.T(), res, chainConfig, testsuite.BigIntComparer())
}
// make sure we don't panic on nil
NotPanics(c.T(), func() {
client.ConfigFromID(nil)
})
}
// TestConfig tests the config.
func (c ClientSuite) TestConfig() {
testConfig := client.Config{}
mockAddress := mocks.MockAddress()
testConfig.SetEthBridgeAddress(mockAddress)
Equal(c.T(), testConfig.GetEthBridgeAddress(), mockAddress)
}
// TestChainSigner is a sanity check that our configs correctly use the signer.
func (c ClientSuite) TestChainSigner() {
for _, config := range client.ChainConfigs {
signer := types.MakeSigner(config, big.NewInt(0).SetUint64(math.MaxUint64), uint64(time.Now().Unix()))
False(c.T(), signer.Equal(types.FrontierSigner{}))
False(c.T(), signer.Equal(types.HomesteadSigner{}))
}
}