git.delta.rocks / unique-network / refs/commits / 3c4a992556fd

difftreelog

feat add skip/only/ifWithPallets to itSub/itEth

Daniel Shiposha2022-09-22parent: #35dc5b5.patch.diff
in: master

2 files changed

modifiedtests/src/eth/util/playgrounds/index.tsdiffbeforeafterboth
1212
13import chai from 'chai';13import chai from 'chai';
14import chaiAsPromised from 'chai-as-promised';14import chaiAsPromised from 'chai-as-promised';
15import { requirePalletsOrSkip } from '../../../util/playgrounds';
15chai.use(chaiAsPromised);16chai.use(chaiAsPromised);
16export const expect = chai.expect;17export const expect = chai.expect;
1718
35 }36 }
36};37};
37 38
38export async function itEth(name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean } = {}) {39export async function itEth(name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
39 let i: any = it;40 (opts.only ? it.only :
40 if (opts.only) i = i.only;
41 else if (opts.skip) i = i.skip;
42 i(name, async () => {41 opts.skip ? it.skip : it)(name, async function() {
43 await usingEthPlaygrounds(async (helper, privateKey) => {42 await usingEthPlaygrounds(async (helper, privateKey) => {
43 if (opts.requiredPallets) {
44 requirePalletsOrSkip(this, helper, opts.requiredPallets);
45 }
46
44 await cb({helper, privateKey});47 await cb({helper, privateKey});
45 });48 });
46 });49 });
47}50}
51
52export async function itEthIfWithPallet(name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
53 return itEth(name, cb, {requiredPallets: required, ...opts});
54}
55
48itEth.only = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEth(name, cb, {only: true});56itEth.only = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEth(name, cb, {only: true});
49itEth.skip = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEth(name, cb, {skip: true});57itEth.skip = (name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEth(name, cb, {skip: true});
58
59itEthIfWithPallet.only = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEthIfWithPallet(name, required, cb, {only: true});
60itEthIfWithPallet.skip = (name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itEthIfWithPallet(name, required, cb, {skip: true});
61itEth.ifWithPallets = itEthIfWithPallet;
62
modifiedtests/src/util/playgrounds/index.tsdiffbeforeafterboth
63 });63 });
64 });64 });
65}65}
66export async function itSubIfWithPallet(name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
67 return itSub(name, cb, {requiredPallets: required, ...opts});
68}
66itSub.only = (name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itSub(name, cb, {only: true});69itSub.only = (name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itSub(name, cb, {only: true});
67itSub.skip = (name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itSub(name, cb, {skip: true});70itSub.skip = (name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itSub(name, cb, {skip: true});
71
68itSub.ifWithPallets = (name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itSub(name, cb, {requiredPallets: required});72itSubIfWithPallet.only = (name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itSubIfWithPallet(name, required, cb, {only: true});
73itSubIfWithPallet.skip = (name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => IKeyringPair }) => any) => itSubIfWithPallet(name, required, cb, {skip: true});
74itSub.ifWithPallets = itSubIfWithPallet;
6975