-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcanton_test.go
More file actions
45 lines (38 loc) · 1.22 KB
/
canton_test.go
File metadata and controls
45 lines (38 loc) · 1.22 KB
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
package chain_selectors
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_CantonChainSelectors(t *testing.T) {
for selector, chain := range cantonChainsBySelector {
family, err := GetSelectorFamily(selector)
require.NoError(t, err,
"selector %v should be returned as canton family, but received %v",
selector, err)
require.NotEmpty(t, family)
require.Equal(t, FamilyCanton, family)
id, err := CantonChainIdFromSelector(selector)
require.Nil(t, err)
require.Equal(t, chain.ChainID, id)
returnedChain, exists := CantonChainBySelector(selector)
require.True(t, exists)
require.Equal(t, returnedChain.ChainID, id)
require.Equal(t, id, returnedChain.ChainID)
}
}
func Test_CantonGetChainDetailsByChainIDAndFamily(t *testing.T) {
for k, v := range cantonChainsByChainId {
details, err := GetChainDetailsByChainIDAndFamily(fmt.Sprint(k), FamilyCanton)
assert.NoError(t, err)
assert.Equal(t, v, details)
}
}
func Test_CantonGetChainIDByChainSelector(t *testing.T) {
for k, v := range cantonChainsByChainId {
chainID, err := GetChainIDFromSelector(v.ChainSelector)
assert.NoError(t, err)
assert.Equal(t, chainID, fmt.Sprintf("%v", k))
}
}