Skip to content

Commit

Permalink
test null id (bool is not in json rpc spec)
Browse files Browse the repository at this point in the history
  • Loading branch information
pirtleshell committed Feb 2, 2024
1 parent ebe4be9 commit 0b2b75b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions service/cachemdw/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ func TestUnitTestCacheQueryResponse(t *testing.T) {
expectedRes := strings.Replace(string(defaultQueryResp), "\"id\": 1", fmt.Sprintf("\"id\": \"%s\"", stringId), 1)
require.JSONEq(t, expectedRes, string(resp.JsonRpcResponseResult))

boolId := true
req = mkEVMRPCRequestEnvelope(defaultBlockNumber, boolId)
var nullId *interface{} = nil
req = mkEVMRPCRequestEnvelope(defaultBlockNumber, nullId)
resp, err = serviceCache.GetCachedQueryResponse(ctxb, req)
require.NoError(t, err)
expectedRes = strings.Replace(string(defaultQueryResp), "\"id\": 1", fmt.Sprintf("\"id\": %t", boolId), 1)
expectedRes = strings.Replace(string(defaultQueryResp), "\"id\": 1", "\"id\": null", 1)
require.JSONEq(t, expectedRes, string(resp.JsonRpcResponseResult))
}

Expand Down

0 comments on commit 0b2b75b

Please sign in to comment.