difftreelog
feat add skip/only/ifWithPallets to itSub/itEth
in: master
2 files changed
tests/src/eth/util/playgrounds/index.tsdiffbeforeafterboth121213import 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;171835 }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 }4644 await cb({helper, privateKey});47 await cb({helper, privateKey});45 });48 });46 });49 });47}50}5152export 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}5548itEth.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});5859itEthIfWithPallet.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;62tests/src/util/playgrounds/index.tsdiffbeforeafterboth63 });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});7168itSub.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