difftreelog
feat add testUtils to dev unique helper
in: master
1 file changed
tests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth8import * as defs from '../../interfaces/definitions';8import * as defs from '../../interfaces/definitions';9import {IKeyringPair} from '@polkadot/types/types';9import {IKeyringPair} from '@polkadot/types/types';10import {EventRecord} from '@polkadot/types/interfaces';10import {EventRecord} from '@polkadot/types/interfaces';11import {ICrossAccountId} from './types';11import {ICrossAccountId, TSigner} from './types';12import {FrameSystemEventRecord} from '@polkadot/types/lookup';12import {FrameSystemEventRecord} from '@polkadot/types/lookup';13import {VoidFn} from '@polkadot/api/types';13import {VoidFn} from '@polkadot/api/types';14import {FrameSystemEventRecord} from '@polkadot/types/lookup';151416export class SilentLogger {15export class SilentLogger {17 log(_msg: any, _level: any): void { }16 log(_msg: any, _level: any): void { }65 arrange: ArrangeGroup;64 arrange: ArrangeGroup;66 wait: WaitGroup;65 wait: WaitGroup;67 admin: AdminGroup;66 admin: AdminGroup;67 testUtils: TestUtilGroup;686869 constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {69 constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {70 options.helperBase = options.helperBase ?? DevUniqueHelper;70 options.helperBase = options.helperBase ?? DevUniqueHelper;73 this.arrange = new ArrangeGroup(this);73 this.arrange = new ArrangeGroup(this);74 this.wait = new WaitGroup(this);74 this.wait = new WaitGroup(this);75 this.admin = new AdminGroup(this);75 this.admin = new AdminGroup(this);76 this.testUtils = new TestUtilGroup(this);76 }77 }777878 async connect(wsEndpoint: string, _listeners?: any): Promise<void> {79 async connect(wsEndpoint: string, _listeners?: any): Promise<void> {478 }479 }479}480}481482class TestUtilGroup {483 helper: DevUniqueHelper;484485 constructor(helper: DevUniqueHelper) {486 this.helper = helper;487 }488489 async setTestValue(signer: TSigner, testVal: number) {490 await this.helper.executeExtrinsic(signer, 'api.tx.testUtils.setTestValue', [testVal], true);491 }492493 async incTestValue(signer: TSigner) {494 await this.helper.executeExtrinsic(signer, 'api.tx.testUtils.incTestValue', [], true);495 }496497 async setTestValueAndRollback(signer: TSigner, testVal: number) {498 await this.helper.executeExtrinsic(signer, 'api.tx.testUtils.setTestValueAndRollback', [testVal], true);499 }500501 async testValue() {502 return (await this.helper.callRpc('api.query.testUtils.testValue', [])).toNumber();503 }504505 async justTakeFee(signer: TSigner) {506 await this.helper.executeExtrinsic(signer, 'api.tx.testUtils.justTakeFee', [], true);507 }508509 async selfCancelingInc(signer: TSigner, scheduledId: string, maxTestVal: number) {510 await this.helper.executeExtrinsic(signer, 'api.tx.testUtils.selfCancelingInc', [scheduledId, maxTestVal], true);511 }512}480513481class EventCapture {514class EventCapture {482 helper: DevUniqueHelper;515 helper: DevUniqueHelper;