Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
weiihann committed Oct 21, 2024
1 parent ab69e5a commit 0942c9f
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,12 @@ func TestNewNode(t *testing.T) {

func TestNetworkVerificationOnNonEmptyDB(t *testing.T) {
network := utils.Integration
tests := map[string]struct {
network utils.Network
errString string
}{
"same network": {
network: network,
errString: "",
},
"different network": {
network: utils.Mainnet,
errString: "unable to verify latest block hash; are the database and --network option compatible?",
},
tests := map[string]utils.Network{
"same network": network,
"different network": utils.Mainnet,
}

for description, test := range tests {
for description, nw := range tests {
t.Run(description, func(t *testing.T) {
dbPath := t.TempDir()
log := utils.NewNopZapLogger()
Expand All @@ -78,13 +69,10 @@ func TestNetworkVerificationOnNonEmptyDB(t *testing.T) {

_, err = node.New(&node.Config{
DatabasePath: dbPath,
Network: test.network,
Network: nw,
}, "v0.1")
if test.errString == "" {
require.NoError(t, err)
} else {
require.ErrorContains(t, err, test.errString)
}

require.NoError(t, err)
})
}
}

0 comments on commit 0942c9f

Please sign in to comment.