Skip to content

Commit

Permalink
test(chain): rewrite environment nonce check to integration
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Sep 17, 2023
1 parent 68f931c commit 3cf503d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 47 deletions.
45 changes: 0 additions & 45 deletions test/environment/name-claim-queue.mjs

This file was deleted.

2 changes: 0 additions & 2 deletions test/examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ echo Run environment/node.ts
./test/environment/node.ts
echo Run environment/node-unhandled-exception.mjs
./test/environment/node-unhandled-exception.mjs
echo Run environment/name-claim-queue.mjs
./test/environment/name-claim-queue.mjs

echo Check typescript
cd ./test/environment/typescript/
Expand Down
19 changes: 19 additions & 0 deletions test/integration/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,23 @@ describe('Node Chain', () => {
expect(results).to.be.eql(numbers.map((v) => BigInt(v * 100)));
expect(getCount()).to.be.equal(2);
});

it('uses nonce based on transactions in mempool', async () => {
const sdk = await getSdk(1);
await sdk.transferFunds(1, aeSdk.address);
const txHashes: Encoded.TxHash[] = [];
for (let i = 0; i < 3; i += 1) {
const { hash } = await sdk.spend(1, sdk.address, { waitMined: false, verify: false });
txHashes.push(hash);
}

const height = await sdk.getHeight();
expect(await Promise.race([
sdk.poll(txHashes[0]),
sdk.awaitHeight(height + 2).then(() => 'timeout'),
])).to.be.equal('timeout');

await aeSdk.transferFunds(0.5, sdk.address);
await Promise.all(txHashes.map((hash) => sdk.poll(hash)));

Check failure on line 199 in test/integration/chain.ts

View workflow job for this annotation

GitHub Actions / main

Functions that return promises must be async
});
});

0 comments on commit 3cf503d

Please sign in to comment.