@@ -242,10 +242,7 @@ describe('@ethGetTransactionByHash eth_getTransactionByHash tests', async functi
242242 . onGet ( `contracts/results/${ uniqueTxHash } ` )
243243 . reply ( 200 , JSON . stringify ( detailedResultsWithNullNullableValues ) ) ;
244244 const result = await ethImpl . getTransactionByHash ( uniqueTxHash , requestDetails ) ;
245- expect ( result ) . to . not . be . null ;
246-
247- expect ( result ) . to . exist ;
248- if ( result ) expect ( result . gas ) . to . eq ( '0x0' ) ;
245+ expect ( result ! . gas ) . to . eq ( '0x0' ) ;
249246 } ) ;
250247
251248 it ( 'handles transactions with null amount' , async function ( ) {
@@ -259,10 +256,7 @@ describe('@ethGetTransactionByHash eth_getTransactionByHash tests', async functi
259256 . onGet ( `contracts/results/${ uniqueTxHash } ` )
260257 . reply ( 200 , JSON . stringify ( detailedResultsWithNullNullableValues ) ) ;
261258 const result = await ethImpl . getTransactionByHash ( uniqueTxHash , requestDetails ) ;
262- expect ( result ) . to . not . be . null ;
263-
264- expect ( result ) . to . exist ;
265- if ( result ) expect ( result . value ) . to . eq ( '0x0' ) ;
259+ expect ( result ! . value ) . to . eq ( '0x0' ) ;
266260 } ) ;
267261
268262 it ( 'handles transactions with v as null' , async function ( ) {
@@ -277,10 +271,7 @@ describe('@ethGetTransactionByHash eth_getTransactionByHash tests', async functi
277271 . onGet ( `contracts/results/${ uniqueTxHash } ` )
278272 . reply ( 200 , JSON . stringify ( detailedResultsWithNullNullableValues ) ) ;
279273 const result = await ethImpl . getTransactionByHash ( uniqueTxHash , requestDetails ) ;
280- expect ( result ) . to . not . be . null ;
281-
282- expect ( result ) . to . exist ;
283- if ( result ) expect ( result . v ) . to . eq ( '0x0' ) ;
274+ expect ( result ! . v ) . to . eq ( '0x0' ) ;
284275 } ) ;
285276
286277 it ( 'should throw an error if transaction_index is falsy' , async function ( ) {
@@ -298,7 +289,6 @@ describe('@ethGetTransactionByHash eth_getTransactionByHash tests', async functi
298289 await ethImpl . getTransactionByHash ( uniqueTxHash , requestDetails ) ;
299290 expect . fail ( 'should have thrown an error' ) ;
300291 } catch ( error ) {
301- expect ( error ) . to . exist ;
302292 expect ( error ) . to . eq ( predefined . DEPENDENT_SERVICE_IMMATURE_RECORDS ) ;
303293 }
304294 } ) ;
@@ -317,7 +307,6 @@ describe('@ethGetTransactionByHash eth_getTransactionByHash tests', async functi
317307 await ethImpl . getTransactionByHash ( uniqueTxHash , requestDetails ) ;
318308 expect . fail ( 'should have thrown an error' ) ;
319309 } catch ( error ) {
320- expect ( error ) . to . exist ;
321310 expect ( error ) . to . eq ( predefined . DEPENDENT_SERVICE_IMMATURE_RECORDS ) ;
322311 }
323312 } ) ;
@@ -338,7 +327,6 @@ describe('@ethGetTransactionByHash eth_getTransactionByHash tests', async functi
338327 await ethImpl . getTransactionByHash ( uniqueTxHash , requestDetails ) ;
339328 expect . fail ( 'should have thrown an error' ) ;
340329 } catch ( error ) {
341- expect ( error ) . to . exist ;
342330 expect ( error ) . to . eq ( predefined . DEPENDENT_SERVICE_IMMATURE_RECORDS ) ;
343331 }
344332 } ) ;
@@ -355,4 +343,17 @@ describe('@ethGetTransactionByHash eth_getTransactionByHash tests', async functi
355343 maxPriorityFeePerGas : '0x43' ,
356344 } ) ;
357345 } ) ;
346+
347+ it ( 'returns to field for transaction with contract revert on contract creation' , async function ( ) {
348+ const detailedResultsWithNullTo = {
349+ ...defaultDetailedContractResultByHash ,
350+ to : null ,
351+ } ;
352+
353+ const uniqueTxHash = '0x15aad7b827375d12d73af57b6a3e84353645fd31305ea58ff52dda53ec640533' ;
354+
355+ restMock . onGet ( `contracts/results/${ uniqueTxHash } ` ) . reply ( 200 , JSON . stringify ( detailedResultsWithNullTo ) ) ;
356+ const result = await ethImpl . getTransactionByHash ( uniqueTxHash , requestDetails ) ;
357+ expect ( result ?. to ) . to . eq ( null ) ;
358+ } ) ;
358359} ) ;
0 commit comments