From f757a215cabd9ff124a2ce311fb7baf0eaedabd0 Mon Sep 17 00:00:00 2001 From: Logan Nguyen Date: Tue, 9 Apr 2024 15:32:49 -0400 Subject: [PATCH] fix: disconnect wsProvider after test Signed-off-by: Logan Nguyen --- packages/server/tests/acceptance/ws/estimateGas.spec.ts | 7 +++++++ packages/server/tests/acceptance/ws/getCode.spec.ts | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/packages/server/tests/acceptance/ws/estimateGas.spec.ts b/packages/server/tests/acceptance/ws/estimateGas.spec.ts index 7eb7ab1a54..f6436da35e 100644 --- a/packages/server/tests/acceptance/ws/estimateGas.spec.ts +++ b/packages/server/tests/acceptance/ws/estimateGas.spec.ts @@ -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()}`, diff --git a/packages/server/tests/acceptance/ws/getCode.spec.ts b/packages/server/tests/acceptance/ws/getCode.spec.ts index b9482839fe..8804207f16 100644 --- a/packages/server/tests/acceptance/ws/getCode.spec.ts +++ b/packages/server/tests/acceptance/ws/getCode.spec.ts @@ -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()}`);