Skip to content

Commit

Permalink
fix Test_GetLogsForQuery (#1836)
Browse files Browse the repository at this point in the history
* fix Test_GetLogsForQuery

* chore: fix lint errors

* chore: accommodate review changes

- Review changes suggested in PR #1787
  • Loading branch information
sarvalabs-shravanth committed Sep 1, 2023
1 parent 9b5bbe4 commit ece1c5e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions jsonrpc/filter_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,14 @@ func Test_GetLogsForQuery(t *testing.T) {

foundLogs, logError := f.GetLogsForQuery(testCase.query)

if logError != nil && testCase.expectedError == nil {
// If there is an error and test isn't expected to fail
t.Fatalf("Error: %v", logError)
}

if testCase.expectedError != nil {
assert.Lenf(t, foundLogs, testCase.expectedLength, "Invalid number of logs found")
assert.ErrorIs(t, logError, testCase.expectedError)

return
}

assert.ErrorIs(t, logError, testCase.expectedError)
assert.NoError(t, logError)
assert.Lenf(t, foundLogs, testCase.expectedLength, "Invalid number of logs found")
})
}
}
Expand Down Expand Up @@ -593,7 +591,7 @@ func TestFilterWebsocket(t *testing.T) {
select {
case <-msgCh:
case <-time.After(2 * time.Second):
t.Fatal("bad")
t.Fatal("no new block events received in the predefined time slot")
}
}

Expand Down Expand Up @@ -621,7 +619,7 @@ func TestFilterPendingTxWebsocket(t *testing.T) {
select {
case <-msgCh:
case <-time.After(2 * time.Second):
t.Fatal("bad")
t.Fatal("no tx pool events received in the predefined time slot")
}
}

Expand Down

0 comments on commit ece1c5e

Please sign in to comment.