2222import { expect } from 'chai' ;
2323import { ethers , WebSocketProvider } from 'ethers' ;
2424import { WsTestConstant , WsTestHelper } from '../helper' ;
25+ import { Utils } from '@hashgraph/json-rpc-server/tests/helpers/utils' ;
2526
26- describe ( '@release @ web-socket-batch-1 eth_getBlockByNumber' , async function ( ) {
27+ describe ( '@web-socket-batch-1 eth_getBlockByNumber' , async function ( ) {
2728 const METHOD_NAME = 'eth_getBlockByNumber' ;
2829 const INVALID_PARAMS = [
2930 [ ] ,
@@ -48,7 +49,9 @@ describe('@release @web-socket-batch-1 eth_getBlockByNumber', async function ()
4849
4950 after ( async ( ) => {
5051 // expect all the connections to be closed after all
51- expect ( global . socketServer . _connections ) . to . eq ( 0 ) ;
52+ if ( global && global . socketServer ) {
53+ expect ( global . socketServer . _connections ) . to . eq ( 0 ) ;
54+ }
5255 } ) ;
5356
5457 describe ( WsTestConstant . STANDARD_WEB_SOCKET , ( ) => {
@@ -58,9 +61,10 @@ describe('@release @web-socket-batch-1 eth_getBlockByNumber', async function ()
5861 } ) ;
5962 }
6063
61- it ( `Should execute eth_getBlockByNumber on Standard Web Socket and handle valid requests correctly` , async ( ) => {
64+ it ( `@release Should execute eth_getBlockByNumber on Standard Web Socket and handle valid requests correctly` , async ( ) => {
6265 const expectedResult = await global . relay . call ( METHOD_NAME , [ 'latest' , false ] ) ;
6366 const response = await WsTestHelper . sendRequestToStandardWebSocket ( METHOD_NAME , [ expectedResult . number , true ] ) ;
67+ await Utils . wait ( 1000 ) ;
6468 WsTestHelper . assertJsonRpcObject ( response ) ;
6569 expect ( response . result ) . to . deep . eq ( expectedResult ) ;
6670 } ) ;
@@ -73,9 +77,10 @@ describe('@release @web-socket-batch-1 eth_getBlockByNumber', async function ()
7377 } ) ;
7478 }
7579
76- it ( `Should execute eth_getBlockByNumber on Ethers Web Socket Provider and handle valid requests correctly` , async ( ) => {
80+ it ( `@release Should execute eth_getBlockByNumber on Ethers Web Socket Provider and handle valid requests correctly` , async ( ) => {
7781 const expectedResult = await global . relay . call ( METHOD_NAME , [ 'latest' , false ] ) ;
7882 const result = await ethersWsProvider . send ( METHOD_NAME , [ expectedResult . number , true ] ) ;
83+ await Utils . wait ( 1000 ) ;
7984 expect ( result ) . to . deep . eq ( expectedResult ) ;
8085 } ) ;
8186 } ) ;
0 commit comments