git.delta.rocks / unique-network / refs/commits / 686b7bd51dff

difftreelog

fix use newBlocks from playgrounds

rkv2022-10-04parent: #d664736.patch.diff
in: master

1 file changed

modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
16import {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';
18
19async function waitNewBlocks(helper: EthUniqueHelper, count: number) {
20 // eslint-disable-next-line no-async-promise-executor
21 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}
3218
33async 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));
3824
39 expect(after < before).to.be.true;25 expect(after < before).to.be.true;