git.delta.rocks / unique-network / refs/commits / fe5dd90e2b65

difftreelog

tests(dev-mode): all fixed up

Fahrrader2022-04-06parent: #219f5f0.patch.diff
in: master

4 files changed

modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
212 vec![212 vec![
213 get_account_id_from_seed::<sr25519::Public>("Alice"),213 get_account_id_from_seed::<sr25519::Public>("Alice"),
214 get_account_id_from_seed::<sr25519::Public>("Bob"),214 get_account_id_from_seed::<sr25519::Public>("Bob"),
215 get_account_id_from_seed::<sr25519::Public>("Charlie"),
216 get_account_id_from_seed::<sr25519::Public>("Dave"),
217 get_account_id_from_seed::<sr25519::Public>("Eve"),
218 get_account_id_from_seed::<sr25519::Public>("Ferdie"),
219 get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
220 get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
221 get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
222 get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
223 get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
224 get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
215 ],225 ],
216 1000226 1000
217 )227 )
modifiedtests/src/eth/base.test.tsdiffbeforeafterboth
34 const userB = createEthAccount(web3);34 const userB = createEthAccount(web3);
3535
36 const cost = await recordEthFee(api, userA, () => web3.eth.sendTransaction({from: userA, to: userB, value: '1000000', ...GAS_ARGS}));36 const cost = await recordEthFee(api, userA, () => web3.eth.sendTransaction({from: userA, to: userB, value: '1000000', ...GAS_ARGS}));
37 const balanceB = await ethBalanceViaSub(api, userB);
37 expect(cost - await ethBalanceViaSub(api, userB) < BigInt(0.2 * Number(UNIQUE))).to.be.true;38 expect(cost - balanceB < BigInt(0.2 * Number(UNIQUE))).to.be.true;
38 });39 });
3940
40 itWeb3('NFT transfer is close to 0.15 UNQ', async ({web3, api}) => {41 itWeb3('NFT transfer is close to 0.15 UNQ', async ({web3, api}) => {
modifiedtests/src/eth/util/helpers.tsdiffbeforeafterboth
29import privateKey from '../../substrate/privateKey';29import privateKey from '../../substrate/privateKey';
30import contractHelpersAbi from './contractHelpersAbi.json';30import contractHelpersAbi from './contractHelpersAbi.json';
31import getBalance from '../../substrate/get-balance';31import getBalance from '../../substrate/get-balance';
32import waitNewBlocks from '../../substrate/wait-new-blocks';
3233
33export const GAS_ARGS = {gas: 2500000};34export const GAS_ARGS = {gas: 2500000};
3435
287288
288 await call();289 await call();
289290
291 // In dev mode, the transaction might not finish processing in time
292 await waitNewBlocks(api, 1);
290 const after = await ethBalanceViaSub(api, user);293 const after = await ethBalanceViaSub(api, user);
291294
292 // Can't use .to.be.less, because chai doesn't supports bigint295 // Can't use .to.be.less, because chai doesn't supports bigint
modifiedtests/src/util/helpers.tsdiffbeforeafterboth
344 // Run the CreateCollection transaction344 // Run the CreateCollection transaction
345 const alicePrivateKey = privateKey('//Alice');345 const alicePrivateKey = privateKey('//Alice');
346 const tx = api.tx.unique.createCollectionEx({name: strToUTF16(name), description: strToUTF16(description), tokenPrefix: strToUTF16(tokenPrefix), mode: modeprm as any});346 const tx = api.tx.unique.createCollectionEx({name: strToUTF16(name), description: strToUTF16(description), tokenPrefix: strToUTF16(tokenPrefix), mode: modeprm as any});
347 const events = await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;347 await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;
348 const result = getCreateCollectionResult(events);
349348
350 // Get number of collections after the transaction349 // Get number of collections after the transaction
351 const collectionCountAfter = await getCreatedCollectionCount(api);350 const collectionCountAfter = await getCreatedCollectionCount(api);
352351
353 // What to expect352 // What to expect
354 // tslint:disable-next-line:no-unused-expression
355 expect(result.success).to.be.false;
356 expect(collectionCountAfter).to.be.equal(collectionCountBefore, 'Error: Collection with incorrect data created.');353 expect(collectionCountAfter).to.be.equal(collectionCountBefore, 'Error: Collection with incorrect data created.');
357 });354 });
358}355}