-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathenvironment_test.go
91 lines (87 loc) · 1.97 KB
/
environment_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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package deployment
import (
"reflect"
"testing"
chain_selectors "github.com/smartcontractkit/chain-selectors"
)
func TestNode_OCRConfigForChainSelector(t *testing.T) {
var m = map[chain_selectors.ChainDetails]OCRConfig{
chain_selectors.ChainDetails{
ChainSelector: chain_selectors.APTOS_TESTNET.Selector,
ChainName: chain_selectors.APTOS_TESTNET.Name,
}: OCRConfig{
KeyBundleID: "aptos bundle 1",
},
chain_selectors.ChainDetails{
ChainSelector: chain_selectors.ETHEREUM_MAINNET_ARBITRUM_1.Selector,
ChainName: chain_selectors.ETHEREUM_MAINNET_ARBITRUM_1.Name,
}: OCRConfig{
KeyBundleID: "arb bundle 1",
},
}
type fields struct {
SelToOCRConfig map[chain_selectors.ChainDetails]OCRConfig
}
type args struct {
chainSel uint64
}
tests := []struct {
name string
fields fields
args args
want OCRConfig
exist bool
}{
{
name: "aptos ok",
fields: fields{
SelToOCRConfig: m,
},
args: args{
chainSel: chain_selectors.APTOS_TESTNET.Selector,
},
want: OCRConfig{
KeyBundleID: "aptos bundle 1",
},
exist: true,
},
{
name: "arb ok",
fields: fields{
SelToOCRConfig: m,
},
args: args{
chainSel: chain_selectors.ETHEREUM_MAINNET_ARBITRUM_1.Selector,
},
want: OCRConfig{
KeyBundleID: "arb bundle 1",
},
exist: true,
},
{
name: "no exist",
fields: fields{
SelToOCRConfig: m,
},
args: args{
chainSel: chain_selectors.WEMIX_MAINNET.Selector, // not in test data
},
want: OCRConfig{},
exist: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
n := Node{
SelToOCRConfig: tt.fields.SelToOCRConfig,
}
got, got1 := n.OCRConfigForChainSelector(tt.args.chainSel)
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("Node.OCRConfigForChainSelector() got = %v, want %v", got, tt.want)
}
if got1 != tt.exist {
t.Errorf("Node.OCRConfigForChainSelector() got1 = %v, want %v", got1, tt.exist)
}
})
}
}