difftreelog
fix use newBlocks from playgrounds
in: master
1 file changed
tests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth16import {IKeyringPair} from '@polkadot/types/types';16import {IKeyringPair} from '@polkadot/types/types';17import {usingEthPlaygrounds, itEth, expect, EthUniqueHelper} from './util/playgrounds';17import {usingEthPlaygrounds, itEth, expect, EthUniqueHelper} from './util/playgrounds';1819async function waitNewBlocks(helper: EthUniqueHelper, count: number) {20 // eslint-disable-next-line no-async-promise-executor21 return new Promise<void>(async (resolve) => {22 const unsubscribe = await helper.callRpc('api.rpc.chain.subscribeNewHeads', [() => {23 if (count > 0) {24 count--;25 } else {26 unsubscribe();27 resolve();28 }29 }]);30 });31}321833async function recordEthFee(helper: EthUniqueHelper, userAddress: string, call: () => Promise<any>) {19async function recordEthFee(helper: EthUniqueHelper, userAddress: string, call: () => Promise<any>) {34 const before = await helper.balance.getSubstrate(helper.address.ethToSubstrate(userAddress));20 const before = await helper.balance.getSubstrate(helper.address.ethToSubstrate(userAddress));35 await call();21 await call();36 waitNewBlocks(helper, 1);22 await helper.wait.newBlocks(1);37 const after = await helper.balance.getSubstrate(helper.address.ethToSubstrate(userAddress));23 const after = await helper.balance.getSubstrate(helper.address.ethToSubstrate(userAddress));382439 expect(after < before).to.be.true;25 expect(after < before).to.be.true;