Skip to content

Commit 4f36b36

Browse files
committed
fix unit tests.
1 parent 85c0a0d commit 4f36b36

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

state/stateChanges/collector_test.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package stateChanges
22

33
import (
4+
"encoding/hex"
45
"fmt"
56
"math/big"
67
"strconv"
@@ -344,10 +345,10 @@ func TestStateChangesCollector_Publish(t *testing.T) {
344345
require.NoError(t, err)
345346

346347
require.Len(t, stateChangesForTx, 1)
347-
require.Len(t, stateChangesForTx["hash0"].StateChanges, 10)
348+
require.Len(t, stateChangesForTx[hex.EncodeToString([]byte("hash0"))].StateChanges, 10)
348349

349350
require.Equal(t, stateChangesForTx, map[string]*data.StateChanges{
350-
"hash0": {
351+
hex.EncodeToString([]byte("hash0")): {
351352
StateChanges: []*data.StateChange{
352353
{Type: data.Write, TxHash: []byte("hash0")},
353354
{Type: data.Write, TxHash: []byte("hash0")},
@@ -391,10 +392,10 @@ func TestStateChangesCollector_Publish(t *testing.T) {
391392
require.NoError(t, err)
392393

393394
require.Len(t, stateChangesForTx, 1)
394-
require.Len(t, stateChangesForTx["hash1"].StateChanges, 10)
395+
require.Len(t, stateChangesForTx[hex.EncodeToString([]byte("hash1"))].StateChanges, 10)
395396

396397
require.Equal(t, stateChangesForTx, map[string]*data.StateChanges{
397-
"hash1": {
398+
hex.EncodeToString([]byte("hash1")): {
398399
StateChanges: []*data.StateChange{
399400
{Type: data.Read, TxHash: []byte("hash1")},
400401
{Type: data.Read, TxHash: []byte("hash1")},
@@ -438,11 +439,11 @@ func TestStateChangesCollector_Publish(t *testing.T) {
438439
require.NoError(t, err)
439440

440441
require.Len(t, stateChangesForTx, 2)
441-
require.Len(t, stateChangesForTx["hash0"].StateChanges, 10)
442-
require.Len(t, stateChangesForTx["hash1"].StateChanges, 10)
442+
require.Len(t, stateChangesForTx[hex.EncodeToString([]byte("hash0"))].StateChanges, 10)
443+
require.Len(t, stateChangesForTx[hex.EncodeToString([]byte("hash1"))].StateChanges, 10)
443444

444445
require.Equal(t, stateChangesForTx, map[string]*data.StateChanges{
445-
"hash0": {
446+
hex.EncodeToString([]byte("hash0")): {
446447
StateChanges: []*data.StateChange{
447448
{Type: data.Write, TxHash: []byte("hash0")},
448449
{Type: data.Write, TxHash: []byte("hash0")},
@@ -456,7 +457,7 @@ func TestStateChangesCollector_Publish(t *testing.T) {
456457
{Type: data.Write, TxHash: []byte("hash0")},
457458
},
458459
},
459-
"hash1": {
460+
hex.EncodeToString([]byte("hash1")): {
460461
StateChanges: []*data.StateChange{
461462
{Type: data.Read, TxHash: []byte("hash1")},
462463
{Type: data.Read, TxHash: []byte("hash1")},

0 commit comments

Comments
 (0)