Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit e9afeb5

Browse files
author
Kris Urbas
committed
close connections in other test files
1 parent c700d82 commit e9afeb5

20 files changed

+73
-15
lines changed

packages/web3-eth-contract/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
4040
"test:watch": "npm test -- --watch",
4141
"test:unit": "jest --config=./test/unit/jest.config.js",
42-
"test:integration": "jest --config=./test/integration/jest.config.js --runInBand",
42+
"test:integration": "jest --config=./test/integration/jest.config.js --runInBand --detectOpenHandles",
4343
"test:e2e:electron": "npx cypress run --headless --browser electron --env grep='ignore',invert=true",
4444
"test:e2e:chrome": "npx cypress run --headless --browser chrome --env grep='ignore',invert=true",
4545
"test:e2e:firefox": "npx cypress run --headless --browser firefox --env grep='ignore',invert=true"

packages/web3-eth-contract/test/integration/contract_accesslist.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
describeIf,
2424
getSystemTestBackend,
2525
BACKEND,
26+
closeOpenConnection,
2627
} from '../fixtures/system_test_utils';
2728

2829
describe('contract', () => {
@@ -46,6 +47,10 @@ describe('contract', () => {
4647
sendOptions = { from: acc.address, gas: '1000000' };
4748
});
4849

50+
afterAll(async () => {
51+
await closeOpenConnection(contract);
52+
});
53+
4954
it('create access list for setter', async () => {
5055
const deployedContract = await contract.deploy(deployOptions).send(sendOptions);
5156
deployedContract.defaultAccount = acc.address;

packages/web3-eth-contract/test/integration/contract_clone.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717
import { Contract } from '../../src';
1818
import { GreeterBytecode, GreeterAbi } from '../shared_fixtures/build/Greeter';
19-
import { getSystemTestProvider, createTempAccount } from '../fixtures/system_test_utils';
19+
import {
20+
getSystemTestProvider,
21+
createTempAccount,
22+
closeOpenConnection,
23+
} from '../fixtures/system_test_utils';
2024

2125
describe('contract', () => {
2226
describe('clone', () => {
2327
let contract: Contract<typeof GreeterAbi>;
2428
let deployOptions: Record<string, unknown>;
2529
let sendOptions: Record<string, unknown>;
30+
2631
beforeAll(async () => {
2732
contract = new Contract(GreeterAbi, undefined, {
2833
provider: getSystemTestProvider(),
@@ -37,6 +42,10 @@ describe('contract', () => {
3742
sendOptions = { from: acc.address, gas: '1000000' };
3843
});
3944

45+
afterAll(async () => {
46+
await closeOpenConnection(contract);
47+
});
48+
4049
it('should clone the contract but with same address', async () => {
4150
const deployedContract = await contract.deploy(deployOptions).send(sendOptions);
4251
const newContract = deployedContract.clone();

packages/web3-eth-contract/test/integration/contract_defaults.test.ts renamed to packages/web3-eth-contract/test/integration/contract_defaults.x.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ import { Web3Context } from 'web3-core';
2020

2121
import { Contract } from '../../src';
2222
import { GreeterBytecode, GreeterAbi } from '../shared_fixtures/build/Greeter';
23-
import { getSystemTestProvider, createTempAccount } from '../fixtures/system_test_utils';
23+
import {
24+
getSystemTestProvider,
25+
createTempAccount,
26+
closeOpenConnection,
27+
} from '../fixtures/system_test_utils';
2428

2529
describe('contract', () => {
2630
describe('defaults', () => {
@@ -43,6 +47,10 @@ describe('contract', () => {
4347
sendOptions = { from: acc.address, gas: '1000000' };
4448
});
4549

50+
afterAll(async () => {
51+
await closeOpenConnection(contract);
52+
});
53+
4654
it('should use "defaultAccount" on "instance" level instead of "from"', async () => {
4755
const deployedContract = await contract.deploy(deployOptions).send(sendOptions);
4856
// eslint-disable-next-line prefer-destructuring

packages/web3-eth-contract/test/integration/contract_defaults_extra.test.ts renamed to packages/web3-eth-contract/test/integration/contract_defaults_extra.x.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('contract defaults (extra)', () => {
5959
sendOptions = { from: acc.address, gas: '1000000' };
6060
});
6161

62-
afterEach(async () => {
62+
afterAll(async () => {
6363
await closeOpenConnection(contract);
6464
});
6565

packages/web3-eth-contract/test/integration/contract_empty_string.test.ts renamed to packages/web3-eth-contract/test/integration/contract_empty_string.x.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

1818
import { Contract } from '../../src';
19-
import { getSystemTestProvider, createTempAccount } from '../fixtures/system_test_utils';
19+
import {
20+
getSystemTestProvider,
21+
createTempAccount,
22+
closeOpenConnection,
23+
} from '../fixtures/system_test_utils';
2024
import { MyContractAbi, MyContractBytecode } from '../fixtures/MyContract';
2125

2226
describe('request empty string from contract', () => {
2327
let contract: Contract<typeof MyContractAbi>;
2428
let deployOptions: Record<string, unknown>;
2529
let sendOptions: Record<string, unknown>;
30+
2631
beforeAll(async () => {
2732
contract = new Contract(MyContractAbi, undefined, {
2833
provider: getSystemTestProvider(),
@@ -37,6 +42,10 @@ describe('request empty string from contract', () => {
3742
sendOptions = { from: acc.address, gas: '1000000' };
3843
});
3944

45+
afterAll(async () => {
46+
await closeOpenConnection(contract);
47+
});
48+
4049
it('should fetch empty string', async () => {
4150
const deployedContract = await contract.deploy(deployOptions).send(sendOptions);
4251

packages/web3-eth-contract/test/integration/contract_erc20.test.ts renamed to packages/web3-eth-contract/test/integration/contract_erc20.x.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ describe('contract', () => {
8080
contractDeployed = await contract.deploy(deployOptions).send(sendOptions);
8181
});
8282

83-
afterAll(async () => {
84-
await closeOpenConnection(contractDeployed);
85-
});
86-
8783
describe('methods', () => {
8884
it('should return the name', async () => {
8985
expect(await contractDeployed.methods.name().call()).toBe('Gold');

packages/web3-eth-contract/test/integration/contract_erc721.test.ts renamed to packages/web3-eth-contract/test/integration/contract_erc721.x.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ describe('contract', () => {
5454

5555
afterAll(async () => {
5656
await closeOpenConnection(contract);
57-
await closeOpenConnection(contractDeployed);
5857
});
5958

6059
it('should deploy the contract', async () => {

0 commit comments

Comments
 (0)