fix: integration tests

This commit is contained in:
Pratik Patil 2025-05-22 17:07:09 +05:30
parent ef31b7bc03
commit c8ff1fed5f
No known key found for this signature in database
GPG key ID: AFDCA496554874B3
2 changed files with 14 additions and 6 deletions

View file

@ -198,3 +198,11 @@ func (b *TestBackend) Pending() (*types.Block, types.Receipts, *state.StateDB) {
func (b *TestBackend) NewMatcherBackend() filtermaps.MatcherBackend { func (b *TestBackend) NewMatcherBackend() filtermaps.MatcherBackend {
panic("implement me") panic("implement me")
} }
func (b *TestBackend) CurrentView() *filtermaps.ChainView {
panic("implement me")
}
func (b *TestBackend) HistoryPruningCutoff() uint64 {
return 0
}

View file

@ -109,27 +109,27 @@ func testGetTransactionReceiptsByBlock(t *testing.T, publicBlockchainAPI *ethapi
// Test for GetTransactionByBlockNumberAndIndex // Test for GetTransactionByBlockNumberAndIndex
func testGetTransactionByBlockNumberAndIndex(t *testing.T, publicTransactionPoolAPI *ethapi.TransactionAPI) { func testGetTransactionByBlockNumberAndIndex(t *testing.T, publicTransactionPoolAPI *ethapi.TransactionAPI) {
// check 1 : False ( no transaction ) // check 1 : False ( no transaction )
tx := publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(1), 0) tx, _ := publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(1), 0)
assert.Nil(t, tx) assert.Nil(t, tx)
// check 2 : Normal Transaction // check 2 : Normal Transaction
tx = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(2), 0) tx, _ = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(2), 0)
assert.Equal(t, common.HexToAddress("0x24"), *tx.To) assert.Equal(t, common.HexToAddress("0x24"), *tx.To)
// check 3 : Normal Transaction // check 3 : Normal Transaction
tx = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(3), 0) tx, _ = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(3), 0)
assert.Equal(t, common.HexToAddress("0x992"), *tx.To) assert.Equal(t, common.HexToAddress("0x992"), *tx.To)
// check 4 : Normal Transaction // check 4 : Normal Transaction
tx = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(3), 1) tx, _ = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(3), 1)
assert.Equal(t, common.HexToAddress("0x993"), *tx.To) assert.Equal(t, common.HexToAddress("0x993"), *tx.To)
// check 5 : Normal Transaction // check 5 : Normal Transaction
tx = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(4), 0) tx, _ = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(4), 0)
assert.Equal(t, common.HexToAddress("0x1000"), *tx.To) assert.Equal(t, common.HexToAddress("0x1000"), *tx.To)
// check 5 : State Sync Transaction // check 5 : State Sync Transaction
tx = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(4), 1) tx, _ = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(4), 1)
assert.Equal(t, common.HexToAddress("0x0"), *tx.To) assert.Equal(t, common.HexToAddress("0x0"), *tx.To)
} }