@@ -11,28 +11,41 @@ import (
1111 "github.com/stretchr/testify/require"
1212)
1313
14- func TestAnvil (t * testing.T ) {
15- anvilOut , err := NewBlockchainNetwork (& Input {
16- Type : "anvil" ,
17- Image : "f4hrenh9it/foundry" ,
18- Port : "8545" ,
19- ChainID : "31337" ,
20- })
21- require .NoError (t , err )
14+ func TestChains (t * testing.T ) {
15+ testCases := []struct {
16+ name string
17+ input * Input
18+ chainId int64
19+ }{
20+ {
21+ name : "Anvil" ,
22+ input : & Input {
23+ Type : "anvil" ,
24+ Image : "f4hrenh9it/foundry" ,
25+ Port : "8545" ,
26+ },
27+ chainId : 31337 ,
28+ },
29+ {
30+ name : "AnvilZksync" ,
31+ input : & Input {
32+ Type : "anvil-zksync" ,
33+ },
34+ chainId : 260 ,
35+ },
36+ }
2237
23- testChain (t , 1337 , anvilOut )
38+ for _ , tc := range testCases {
39+ t .Run (tc .name , func (t * testing.T ) {
40+ testChain (t , tc .chainId , tc .input )
41+ })
42+ }
2443}
2544
26- func TestAnvilZksync (t * testing.T ) {
27- anvilOut , err := NewBlockchainNetwork (& Input {
28- Type : "anvil-zksync" ,
29- })
45+ func testChain (t * testing.T , chainId int64 , input * Input ) {
46+ input .ChainID = strconv .FormatInt (chainId , 10 )
47+ output , err := NewBlockchainNetwork (input )
3048 require .NoError (t , err )
31-
32- testChain (t , 260 , anvilOut )
33- }
34-
35- func testChain (t * testing.T , chainId int64 , output * Output ) {
3649 rpcUrl := output .Nodes [0 ].HostHTTPUrl
3750
3851 reqBody := `{"jsonrpc": "2.0", "method": "eth_chainId", "params": [], "id": 1}`
0 commit comments