difftreelog
tests(dev-mode): all fixed up
in: master
4 files changed
node/cli/src/chain_spec.rsdiffbeforeafterboth--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -212,6 +212,16 @@
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
+ get_account_id_from_seed::<sr25519::Public>("Charlie"),
+ get_account_id_from_seed::<sr25519::Public>("Dave"),
+ get_account_id_from_seed::<sr25519::Public>("Eve"),
+ get_account_id_from_seed::<sr25519::Public>("Ferdie"),
+ get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
+ get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
+ get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
+ get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
+ get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
+ get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
1000
)
tests/src/eth/base.test.tsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, deployFlipper, ethBalanceViaSub, GAS_ARGS, itWeb3, recordEthFee} from './util/helpers';18import {expect} from 'chai';19import {createCollectionExpectSuccess, createItemExpectSuccess, UNIQUE} from '../util/helpers';20import nonFungibleAbi from './nonFungibleAbi.json';21import privateKey from '../substrate/privateKey';2223describe('Contract calls', () => {24 itWeb3('Call of simple contract fee is less than 0.2 UNQ', async ({web3, api}) => {25 const deployer = await createEthAccountWithBalance(api, web3);26 const flipper = await deployFlipper(web3, deployer);2728 const cost = await recordEthFee(api, deployer, () => flipper.methods.flip().send({from: deployer}));29 expect(cost < BigInt(0.2 * Number(UNIQUE))).to.be.true;30 });3132 itWeb3('Balance transfer fee is less than 0.2 UNQ', async ({web3, api}) => {33 const userA = await createEthAccountWithBalance(api, web3);34 const userB = createEthAccount(web3);3536 const cost = await recordEthFee(api, userA, () => web3.eth.sendTransaction({from: userA, to: userB, value: '1000000', ...GAS_ARGS}));37 expect(cost - await ethBalanceViaSub(api, userB) < BigInt(0.2 * Number(UNIQUE))).to.be.true;38 });3940 itWeb3('NFT transfer is close to 0.15 UNQ', async ({web3, api}) => {41 const caller = await createEthAccountWithBalance(api, web3);42 const receiver = createEthAccount(web3);4344 const alice = privateKey('//Alice');45 const collection = await createCollectionExpectSuccess({46 mode: {type: 'NFT'},47 });48 const itemId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});4950 const address = collectionIdToAddress(collection);51 const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS});5253 const cost = await recordEthFee(api, caller, () => contract.methods.transfer(receiver, itemId).send(caller));5455 const fee = Number(cost) / Number(UNIQUE);56 const expectedFee = 0.15;57 const tolerance = 0.00002;5859 expect(Math.abs(fee - expectedFee)).to.be.lessThan(tolerance);60 });61});tests/src/eth/util/helpers.tsdiffbeforeafterboth--- 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
tests/src/util/helpers.tsdiffbeforeafterboth--- 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.');
});
}