Skip to content

Commit f49d8be

Browse files
committed
chore: rename some tests
Signed-off-by: nikolay <[email protected]>
1 parent 5154a0b commit f49d8be

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

test/discrepancies/Nonce.js

+10-22
Original file line numberDiff line numberDiff line change
@@ -347,20 +347,9 @@ describe('@discrepancies - Nonce Test Suite', async () => {
347347
const snBefore = await getServicesNonce(signers[0].address);
348348
const mnBefore = await getMirrorNodeNonce(signers[0].address);
349349

350-
try {
351-
const tx = await erc20Contract
352-
.connect(signers[0])
353-
.transfer(
354-
tokenAddress,
355-
signers[1].address,
356-
amount,
357-
Constants.GAS_LIMIT_1_000_000
358-
);
359-
await tx.wait();
360-
} catch (e) {
361-
expect(e).to.exist;
362-
expect(e.code).to.eq(Constants.CALL_EXCEPTION);
363-
}
350+
await Utils.expectToFail(
351+
erc20Contract.transfer(tokenAddress, signers[1].address, amount, Constants.GAS_LIMIT_1_000_000)
352+
);
364353

365354
const snAfter = await getServicesNonce(signers[0].address);
366355
const mnAfter = await getMirrorNodeNonce(signers[0].address);
@@ -439,7 +428,7 @@ describe('@discrepancies - Nonce Test Suite', async () => {
439428
expectIncrementedNonce(snBefore, mnBefore, snAfter, mnAfter);
440429
});
441430

442-
it('should not update nonces when deploying on an address with an already existing account', async function () {
431+
it('should reset nonce when an account has been deleted and created again', async function () {
443432
// create a hollow account
444433
const wallet = await createNewAccountWithBalance(ethers.parseEther('3.1'));
445434
const snAfterCreate = await getServicesNonce(wallet.address);
@@ -477,7 +466,7 @@ describe('@discrepancies - Nonce Test Suite', async () => {
477466
expectNonIncrementedNonce(snAfterNewCreate, mnAfterNewCreate, 0, 0);
478467
});
479468

480-
it('Nonce should NOT be incremented upon static call', async function () {
469+
it('should not increment nonce upon static call', async function () {
481470
const snBeforeTransfer = await getServicesNonce(signers[0].address);
482471
const mnBeforeTransfer = await getMirrorNodeNonce(signers[0].address);
483472
const tx = await internalCallerContract.staticCallExternalFunction.staticCall(signers[1].address)
@@ -488,8 +477,7 @@ describe('@discrepancies - Nonce Test Suite', async () => {
488477
expectNonIncrementedNonce(snBeforeTransfer, mnBeforeTransfer, snAfterTransfer, mnAfterTransfer)
489478
});
490479

491-
it('Nonce should NOT be incremented upon unsuccessfull sent with Direct call - not enough balance', async function () {
492-
const initialValue = 100000 * Utils.tinybarToWeibarCoef
480+
it('should not increment nonce upon unsuccessful sent with direct call - not enough balance', async function () {
493481
const initialWalletBalance = Utils.tinybarToWeibarCoef;
494482

495483
const newWallet = await createNewAccountWithBalance(initialWalletBalance);
@@ -511,7 +499,7 @@ describe('@discrepancies - Nonce Test Suite', async () => {
511499
expectNonIncrementedNonce(snWallet1Before, mnWallet1Before, snWallet1After, mnWallet1After)
512500
});
513501

514-
it('should update signer nonce upon transfer to non-existing account with enough gas limit >600K', async function () {
502+
it('should update nonce upon transfer to non-existing account with enough gas limit > 600k (hollow account creation)', async function () {
515503
const snBeforeTransfer = await getServicesNonce(signers[0].address);
516504
const mnBeforeTransfer = await getMirrorNodeNonce(signers[0].address);
517505

@@ -529,7 +517,7 @@ describe('@discrepancies - Nonce Test Suite', async () => {
529517
expectIncrementedNonce(snBeforeTransfer, mnBeforeTransfer, snAfterCreate, mnAfterCreate);
530518
});
531519

532-
it('should not update nonce upon unsuccessfull transaction due to wrong chain id', async function () {
520+
it('should not update nonce upon unsuccessful transaction due to wrong chain id', async function () {
533521
const wallet1 = ethers.Wallet.createRandom();
534522
const snBeforeTransfer = await getServicesNonce(signers[0].address);
535523
const mnBeforeTransfer = await getMirrorNodeNonce(signers[0].address);
@@ -630,7 +618,7 @@ describe('@discrepancies - Nonce Test Suite', async () => {
630618
expectIncrementedNonce(snBeforeTransfer, mnBeforeTransfer, snAfterCreate, mnAfterCreate);
631619
});
632620

633-
it('hollow account that is finalized with the same transaction that should upgrade its nonce', async function () {
621+
it('should update nonce on hollow account finalization', async function () {
634622
const wallet = await createNewAccountWithBalance(ethers.parseEther('10'));
635623
const wallet2 = ethers.Wallet.createRandom().connect(ethers.provider);
636624

@@ -656,7 +644,7 @@ describe('@discrepancies - Nonce Test Suite', async () => {
656644
expectIncrementedNonce(snBeforeTransfer, mnBeforeTransfer, snAfterCreate, mnAfterCreate);
657645
});
658646

659-
it('hollow account that is finilized with the same transaction that should not upgrade its nonce when offered gas price and and allowance fail check ', async function () {
647+
it('should not update nonce on hollow account finalization due to reversion when offered gas price and allowance fail check', async function () {
660648
const wallet = await createNewAccountWithBalance(ethers.parseEther('10'));
661649

662650
let infoBefore = await Utils.getAccountInfo(wallet.address, sdkClient);

0 commit comments

Comments
 (0)