From fe5dd90e2b6599ef7534160af0427dce2df0fb56 Mon Sep 17 00:00:00 2001 From: Fahrrader Date: Wed, 06 Apr 2022 07:43:53 +0000 Subject: [PATCH] tests(dev-mode): all fixed up --- --- a/node/cli/src/chain_spec.rs +++ b/node/cli/src/chain_spec.rs @@ -212,6 +212,16 @@ vec![ get_account_id_from_seed::("Alice"), get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Ferdie//stash"), ], 1000 ) --- a/tests/src/eth/base.test.ts +++ b/tests/src/eth/base.test.ts @@ -34,7 +34,8 @@ const userB = createEthAccount(web3); const cost = await recordEthFee(api, userA, () => web3.eth.sendTransaction({from: userA, to: userB, value: '1000000', ...GAS_ARGS})); - expect(cost - await ethBalanceViaSub(api, userB) < BigInt(0.2 * Number(UNIQUE))).to.be.true; + const balanceB = await ethBalanceViaSub(api, userB); + expect(cost - balanceB < BigInt(0.2 * Number(UNIQUE))).to.be.true; }); itWeb3('NFT transfer is close to 0.15 UNQ', async ({web3, api}) => { --- a/tests/src/eth/util/helpers.ts +++ b/tests/src/eth/util/helpers.ts @@ -29,6 +29,7 @@ import privateKey from '../../substrate/privateKey'; import contractHelpersAbi from './contractHelpersAbi.json'; import getBalance from '../../substrate/get-balance'; +import waitNewBlocks from '../../substrate/wait-new-blocks'; export const GAS_ARGS = {gas: 2500000}; @@ -287,6 +288,8 @@ await call(); + // In dev mode, the transaction might not finish processing in time + await waitNewBlocks(api, 1); const after = await ethBalanceViaSub(api, user); // Can't use .to.be.less, because chai doesn't supports bigint --- a/tests/src/util/helpers.ts +++ b/tests/src/util/helpers.ts @@ -344,15 +344,12 @@ // Run the CreateCollection transaction const alicePrivateKey = privateKey('//Alice'); const tx = api.tx.unique.createCollectionEx({name: strToUTF16(name), description: strToUTF16(description), tokenPrefix: strToUTF16(tokenPrefix), mode: modeprm as any}); - const events = await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected; - const result = getCreateCollectionResult(events); + await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected; // Get number of collections after the transaction const collectionCountAfter = await getCreatedCollectionCount(api); // What to expect - // tslint:disable-next-line:no-unused-expression - expect(result.success).to.be.false; expect(collectionCountAfter).to.be.equal(collectionCountBefore, 'Error: Collection with incorrect data created.'); }); } -- gitstuff