Skip to content

Commit

Permalink
fix: disconnect wsProvider after test
Browse files Browse the repository at this point in the history
Signed-off-by: Logan Nguyen <[email protected]>
  • Loading branch information
quiet-node committed Apr 9, 2024
1 parent fbe4c78 commit f757a21
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/server/tests/acceptance/ws/estimateGas.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ describe('@release @web-socket eth_estimateGas', async function () {
gasPriceDeviation = parseFloat(expectedGas.toString() ?? '0.2');
});

afterEach(async () => {
if (wsProvider) {
await wsProvider.destroy();
await new Promise((resolve) => setTimeout(resolve, 1000));
}
});

it('@release should execute "eth_estimateGas" for contract call, using a websocket provider', async function () {
const estimatedGas = await wsProvider.estimateGas({
to: `0x${basicContract.contractId.toSolidityAddress()}`,
Expand Down
7 changes: 7 additions & 0 deletions packages/server/tests/acceptance/ws/getCode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ describe('@release @web-socket eth_getCode', async function () {
webSocket = new WebSocket(WS_RELAY_URL);
});

afterEach(async () => {
if (wsProvider) {
await wsProvider.destroy();
await new Promise((resolve) => setTimeout(resolve, 1000));
}
});

it('should return the code ethers WebSocketProvider', async function () {
await new Promise((resolve) => setTimeout(resolve, 1000));
const codeFromWs = await wsProvider.getCode(`0x${basicContract.contractId.toSolidityAddress()}`);
Expand Down

0 comments on commit f757a21

Please sign in to comment.