From ece1c5eb4fef825b2cdd41026d93c0d34c0ddfb2 Mon Sep 17 00:00:00 2001 From: sarvalabs-shravanth <135600588+sarvalabs-shravanth@users.noreply.github.com> Date: Fri, 1 Sep 2023 14:03:14 +0530 Subject: [PATCH] fix Test_GetLogsForQuery (#1836) * fix Test_GetLogsForQuery * chore: fix lint errors * chore: accommodate review changes - Review changes suggested in PR #1787 --- jsonrpc/filter_manager_test.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/jsonrpc/filter_manager_test.go b/jsonrpc/filter_manager_test.go index 5edc4ccc20..0f127ff781 100644 --- a/jsonrpc/filter_manager_test.go +++ b/jsonrpc/filter_manager_test.go @@ -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") }) } } @@ -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") } } @@ -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") } }