@@ -252,68 +252,34 @@ describe('Utils', () => {
252252
253253 // Define test cases as [testName, params, expectedTracer, expectedConfig]
254254 const testCases = [
255- [ 'should handle traceTransaction with only transaction hash' , [ ] , TracerType . OpcodeLogger , { } ] ,
256- [
257- 'should handle traceTransaction with tracer type as second parameter' ,
258- [ { tracer : TracerType . CallTracer } ] ,
259- TracerType . CallTracer ,
260- ] ,
261- [
262- 'should handle traceTransaction with tracer type and config' ,
263- [ { tracer : TracerType . CallTracer , tracerConfig : tracerConfig } ] ,
264- TracerType . CallTracer ,
265- tracerConfig ,
266- ] ,
267- [
268- 'should handle traceTransaction with tracerConfig as second parameter' ,
269- [ tracerConfig ] ,
270- TracerType . OpcodeLogger ,
271- tracerConfig ,
272- ] ,
273- [
274- 'should handle traceTransaction with tracerConfigWrapper as second parameter' ,
275- [
276- {
277- tracer : TracerType . CallTracer ,
278- tracerConfig : tracerConfig ,
279- } ,
280- ] ,
281- TracerType . CallTracer ,
282- tracerConfig ,
283- ] ,
284- [
285- 'should handle traceTransaction with partial tracerConfigWrapper (only tracer)' ,
286- [
287- {
288- tracer : TracerType . CallTracer ,
289- } ,
290- ] ,
291- TracerType . CallTracer ,
292- { } ,
293- ] ,
294- [
295- 'should handle traceTransaction with partial tracerConfigWrapper (only tracerConfig)' ,
296- [
297- {
298- tracerConfig,
299- } ,
300- ] ,
301- TracerType . OpcodeLogger ,
302- tracerConfig ,
303- ] ,
255+ {
256+ name : 'should handle traceTransaction with only transaction hash' ,
257+ params : [ ] ,
258+ expected : [ transactionHash , requestDetails ] ,
259+ } ,
260+ {
261+ name : 'should handle traceTransaction with tracerConfigWrapper as second parameter' ,
262+ params : [ { tracer : TracerType . CallTracer , tracerConfig : tracerConfig } ] ,
263+ expected : [ transactionHash , { tracer : TracerType . CallTracer , tracerConfig : tracerConfig } , requestDetails ] ,
264+ } ,
265+ {
266+ name : 'should handle traceTransaction with partial tracerConfigWrapper (only tracer)' ,
267+ params : [ { tracer : TracerType . CallTracer } ] ,
268+ expected : [ transactionHash , { tracer : TracerType . CallTracer } , requestDetails ] ,
269+ } ,
270+ {
271+ name : 'should handle traceTransaction with empty tracerConfig' ,
272+ params : [ { tracer : TracerType . CallTracer , tracerConfig : { } } ] ,
273+ expected : [ transactionHash , { tracer : TracerType . CallTracer , tracerConfig : { } } , requestDetails ] ,
274+ } ,
304275 ] ;
305276
306277 // Loop through test cases and create tests
307- testCases . forEach ( ( [ testName , params , expectedTracer , expectedConfig ] ) => {
308- it ( testName as string , ( ) => {
309- const result = Utils . arrangeRpcParams (
310- traceTransactionMethod ,
311- [ transactionHash , ...( params as any [ ] ) ] ,
312- requestDetails ,
313- ) ;
314- const tracerObject = { tracer : expectedTracer , tracerConfig : expectedConfig } ;
278+ testCases . forEach ( ( { name, params, expected } ) => {
279+ it ( name , ( ) => {
280+ const result = Utils . arrangeRpcParams ( traceTransactionMethod , [ transactionHash , ...params ] , requestDetails ) ;
315281
316- expect ( result ) . to . deep . equal ( [ transactionHash , tracerObject , requestDetails ] ) ;
282+ expect ( result ) . to . deep . equal ( expected ) ;
317283 } ) ;
318284 } ) ;
319285 } ) ;
0 commit comments