Skip to content

Commit

Permalink
Test fix.
Browse files Browse the repository at this point in the history
Signed-off-by: ebadiere <[email protected]>
  • Loading branch information
ebadiere committed Aug 30, 2023
1 parent 62b38aa commit 7417483
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/hts-precompile/token-transfer/tokenTransferContract.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ describe('TokenTransferContract Test Suite', function () {
[mintedTokenSerialNumber],
Constants.GAS_LIMIT_1_000_000
)

const ownerAfter = await erc721Contract.ownerOf(
nftTokenAddress,
mintedTokenSerialNumber
Expand Down Expand Up @@ -434,16 +435,18 @@ describe('TokenTransferContract Test Suite', function () {
const responseCode = cryptoTransferReceipt.events.filter(
(e) => e.event === Constants.Events.ResponseCode
)[0].args[0]
await new Promise((r) => setTimeout(r, 2000))

const signers0AfterHbarBalance = await signers[0].provider.getBalance(
signers[0].address
)
const signers1AfterHbarBalance = await signers[0].provider.getBalance(
signers[1].address
)

const signers0AfterTokenBalance = await pollForNewERC20Balance(erc20Contract, tokenAddress, signers[0].address, signers0BeforeHbarBalance)

const signers0AfterTokenBalance = await erc20Contract.balanceOf(
tokenAddress,
signers[0].address
)
const signers1AfterTokenBalance = await erc20Contract.balanceOf(
tokenAddress,
signers[1].address
Expand Down Expand Up @@ -475,7 +478,7 @@ async function pollForNewERC20Balance(erc20Contract, tokenAddress, signersAddres
while (numberOfTries < timesToTry) {
balanceAfter = await erc20Contract.balanceOf(tokenAddress, signersAddress);

if (!(balanceAfter.eq(0)) && (!balanceAfter.eq(balanceBefore))) {
if (!balanceAfter.eq(balanceBefore)) {
return balanceAfter;
}

Expand Down

0 comments on commit 7417483

Please sign in to comment.