Skip to content

Commit

Permalink
remedy failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pirtleshell committed Sep 21, 2023
1 parent b3047b0 commit e04a2c2
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions decode/evm_rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"testing"

cosmosmath "cosmossdk.io/math"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/stretchr/testify/assert"
)
Expand All @@ -19,11 +18,7 @@ var (

func TestUnitTestExtractBlockNumberFromEVMRPCRequestReturnsExpectedBlockForValidRequest(t *testing.T) {
requestedBlockNumberHexEncoding := "0x2"
requestBlockNumber, valid := cosmosmath.NewIntFromString(requestedBlockNumberHexEncoding)

if !valid {
t.Fatalf("failed to convert %s to cosmos sdk int", requestedBlockNumberHexEncoding)
}
expectedBlockNumber := int64(2)

validRequest := EVMRPCRequestEnvelope{
Method: "eth_getBlockByNumber",
Expand All @@ -35,7 +30,7 @@ func TestUnitTestExtractBlockNumberFromEVMRPCRequestReturnsExpectedBlockForValid
blockNumber, err := validRequest.ExtractBlockNumberFromEVMRPCRequest(testContext, dummyEthClient)

assert.Nil(t, err)
assert.Equal(t, requestBlockNumber, blockNumber)
assert.Equal(t, expectedBlockNumber, blockNumber)
}

func TestUnitTestExtractBlockNumberFromEVMRPCRequestReturnsExpectedBlockNumberForTag(t *testing.T) {
Expand Down Expand Up @@ -87,5 +82,5 @@ func TestUnitTestExtractBlockNumberFromEVMRPCRequestReturnsErrorWhenUnknownReque

_, err := invalidRequest.ExtractBlockNumberFromEVMRPCRequest(testContext, dummyEthClient)

assert.Equal(t, ErrUncachaebleEthRequest, err)
assert.Equal(t, ErrUncachaebleByBlockNumberEthRequest, err)
}

0 comments on commit e04a2c2

Please sign in to comment.