@@ -10,3 +10,23 @@ test('cacheIdentifierForPayload for latest block', function (t) {
10
10
t . notEqual ( cacheId1 , cacheId2 , 'cacheIds are unique' )
11
11
t . end ( )
12
12
} )
13
+
14
+ test ( 'blockTagForPayload for different methods' , function ( t ) {
15
+ const payloads = [
16
+ { jsonrpc : '2.0' , method : 'eth_getBalance' , params : [ '0x407d73d8a49eeb85d32cf465507dd71d507100c1' , '0x1234' ] , id : 1 } ,
17
+ { jsonrpc : '2.0' , method : 'eth_getCode' , params : [ '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b' , '0x1234' ] , id : 1 } ,
18
+ { jsonrpc : '2.0' , method : 'eth_getTransactionCount' , params : [ '0x407d73d8a49eeb85d32cf465507dd71d507100c1' , '0x1234' ] , id : 1 } ,
19
+ { jsonrpc : '2.0' , method : 'eth_getStorageAt' , params : [ '0x295a70b2de5e3953354a6a8344e616ed314d7251' , '0x0' , '0x1234' ] , id : 1 } ,
20
+ { jsonrpc : '2.0' , method : 'eth_call' , params : [ { to : '0x295a70b2de5e3953354a6a8344e616ed314d7251' } , '0x1234' ] , id : 1 } ,
21
+ { jsonrpc : '2.0' , method : 'eth_estimateGas' , params : [ { to : '0x295a70b2de5e3953354a6a8344e616ed314d7251' } , '0x1234' ] , id : 1 } ,
22
+ { jsonrpc : '2.0' , method : 'eth_getBlockByNumber' , params : [ '0x1234' , true ] , id : 1 } ,
23
+ ]
24
+
25
+
26
+ payloads . forEach ( function ( payload ) {
27
+ const blockTag = cacheUtils . blockTagForPayload ( payload )
28
+ t . isEqual ( blockTag , '0x1234' , 'block tag for ' + payload . method + ' is correct' )
29
+ } )
30
+
31
+ t . end ( )
32
+ } )
0 commit comments