Skip to content

Commit 059c6ad

Browse files
committed
feat: close comnection after tests
Signed-off-by: Mariusz Jasuwienas <mariusz@jasuwienas.pl>
1 parent 8589997 commit 059c6ad

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

test/token-service/erc-20/ERC20Contract.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ describe('ERC20Contract Test Suite', function () {
3939
await utils.grantTokenKyc(tokenCreateContract, tokenAddress);
4040
});
4141

42+
after(async function () {
43+
(await utils.createSDKClient()).close();
44+
});
45+
4246
it('should be able to get token name', async function () {
4347
const name = await erc20Contract.name(tokenAddress);
4448
expect(name).to.equal(Constants.TOKEN_NAME);

test/token-service/utils.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,8 @@ class Utils {
407407

408408
static async getHbarBalance(address) {
409409
const balanceJson = (await this.getAccountBalance(address)).toJSON();
410-
const balanceFloat = parseFloat(balanceJson.hbars);
411410

412-
return balanceFloat;
411+
return parseFloat(balanceJson.hbars);
413412
}
414413

415414
static async getTokenBalance(accountAddress, tokenAddress) {
@@ -636,7 +635,6 @@ class Utils {
636635
pkSigner.publicKey.toEvmAddress(),
637636
clientGenesis
638637
);
639-
clientGenesis.close();
640638
const clientSigner = await Utils.createSDKClient(accountId, pkSigner);
641639

642640
const keyList = new KeyList(
@@ -656,7 +654,6 @@ class Utils {
656654
.freezeWith(clientSigner)
657655
.sign(pkSigner)
658656
).execute(clientSigner);
659-
clientSigner.close();
660657
}
661658
}
662659

@@ -666,7 +663,6 @@ class Utils {
666663
const tokenBalance = await new AccountBalanceQuery()
667664
.setAccountId(accountId)
668665
.execute(client);
669-
client.close();
670666
return tokenBalance;
671667
}
672668

@@ -719,8 +715,6 @@ class Utils {
719715
await (
720716
await tx.freezeWith(clientSigner0).sign(pkSigners[0])
721717
).execute(clientSigner0);
722-
clientSigner0.close();
723-
clientGenesis.close();
724718
}
725719

726720
static getCurrentNetwork() {
@@ -756,7 +750,6 @@ class Utils {
756750
const signTx = await transaction.sign(signerPk);
757751
const txResponse = await signTx.execute(signerClient);
758752
await txResponse.getReceipt(signerClient);
759-
signerClient.close();
760753
}
761754

762755
static defaultKeyValues = {

0 commit comments

Comments
 (0)