From a4751aacdfc08405472dfdd3694765df0414d6ac Mon Sep 17 00:00:00 2001 From: Leonard Chinonso <36096513+leonardchinonso@users.noreply.github.com> Date: Wed, 11 Jan 2023 14:27:05 +0000 Subject: [PATCH] was meant to fix the for select lint, but Alex already did (#6557) --- cmd/devnet/requests/request_generator_test.go | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/cmd/devnet/requests/request_generator_test.go b/cmd/devnet/requests/request_generator_test.go index eb4cdc96b..3ea4f4b4b 100644 --- a/cmd/devnet/requests/request_generator_test.go +++ b/cmd/devnet/requests/request_generator_test.go @@ -66,6 +66,40 @@ func TestRequestGenerator_GetBalance(t *testing.T) { } } +func TestRequestGenerator_GetBlockByNumber(t *testing.T) { + testCases := []struct { + reqId int + blockNum uint64 + withTxs bool + expected string + }{ + { + 1, + 2, + false, + `{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x2",false],"id":1}`, + }, + { + 2, + 16, + false, + `{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x10",false],"id":2}`, + }, + { + 3, + 100, + true, + `{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x64",true],"id":3}`, + }, + } + + for _, testCase := range testCases { + reqGen := MockRequestGenerator(testCase.reqId) + got := reqGen.GetBlockByNumber(testCase.blockNum, testCase.withTxs) + require.EqualValues(t, testCase.expected, got) + } +} + func TestRequestGenerator_GetLogs(t *testing.T) { testCases := []struct { reqId int