difftreelog
fix(test) remove token schedulers from tests
in: master
3 files changed
tests/src/maintenance.seqtest.tsdiffbeforeafterboth192 const blocksToWait = 6;192 const blocksToWait = 6;193193194 // Scheduling works before the maintenance194 // Scheduling works before the maintenance195 await nftBeforeMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdBeforeMM})195 await helper.scheduler.scheduleAfter(blocksToWait, {scheduledId: scheduledIdBeforeMM})196 .transfer(bob, {Substrate: superuser.address});196 .nft.transferToken(bob, collection.collectionId, nftBeforeMM.tokenId, {Substrate: superuser.address});197197198198 await helper.wait.newBlocks(blocksToWait + 1);199 await helper.wait.newBlocks(blocksToWait + 1);199 expect(await nftBeforeMM.getOwner()).to.be.deep.equal({Substrate: superuser.address});200 expect(await nftBeforeMM.getOwner()).to.be.deep.equal({Substrate: superuser.address});200201201 // Schedule a transaction that should occur *during* the maintenance202 // Schedule a transaction that should occur *during* the maintenance202 await nftDuringMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdDuringMM})203 await helper.scheduler.scheduleAfter(blocksToWait, {scheduledId: scheduledIdDuringMM})203 .transfer(bob, {Substrate: superuser.address});204 .nft.transferToken(bob, collection.collectionId, nftDuringMM.tokenId, {Substrate: superuser.address});205204206205 // Schedule a transaction that should occur *after* the maintenance207 // Schedule a transaction that should occur *after* the maintenance206 await nftDuringMM.scheduleAfter(blocksToWait * 2, {scheduledId: scheduledIdBunkerThroughMM})208 await helper.scheduler.scheduleAfter(blocksToWait * 2, {scheduledId: scheduledIdBunkerThroughMM})207 .transfer(bob, {Substrate: superuser.address});209 .nft.transferToken(bob, collection.collectionId, nftDuringMM.tokenId, {Substrate: superuser.address});210208211209 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);212 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);214 expect(await nftDuringMM.getOwner()).to.be.deep.equal({Substrate: bob.address});217 expect(await nftDuringMM.getOwner()).to.be.deep.equal({Substrate: bob.address});215218216 // Any attempts to schedule a tx during the MM should be rejected219 // Any attempts to schedule a tx during the MM should be rejected217 await expect(nftDuringMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdAttemptDuringMM})220 await expect(helper.scheduler.scheduleAfter(blocksToWait, {scheduledId: scheduledIdAttemptDuringMM})218 .transfer(bob, {Substrate: superuser.address}))221 .nft.transferToken(bob, collection.collectionId, nftDuringMM.tokenId, {Substrate: superuser.address}))219 .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);222 .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);220223221 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);224 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);222 expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;225 expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;223226224 // Scheduling works after the maintenance227 // Scheduling works after the maintenance225 await nftAfterMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdAfterMM})228 await helper.scheduler.scheduleAfter(blocksToWait, {scheduledId: scheduledIdAfterMM})226 .transfer(bob, {Substrate: superuser.address});229 .nft.transferToken(bob, collection.collectionId, nftAfterMM.tokenId, {Substrate: superuser.address});227230228 await helper.wait.newBlocks(blocksToWait + 1);231 await helper.wait.newBlocks(blocksToWait + 1);229232tests/src/scheduler.seqtest.tsdiffbeforeafterboth48 const scheduledId = scheduleKind == 'named' ? helper.arrange.makeScheduledId() : undefined;48 const scheduledId = scheduleKind == 'named' ? helper.arrange.makeScheduledId() : undefined;49 const blocksBeforeExecution = 4;49 const blocksBeforeExecution = 4;5051 await token.scheduleAfter(blocksBeforeExecution, {scheduledId})50 await helper.scheduler.scheduleAfter(blocksBeforeExecution, {scheduledId})52 .transfer(alice, {Substrate: bob.address});51 .nft.transferToken(alice, collection.collectionId, token.tokenId, {Substrate: bob.address});53 const executionBlock = await helper.chain.getLatestBlockNumber() + blocksBeforeExecution + 1;52 const executionBlock = await helper.chain.getLatestBlockNumber() + blocksBeforeExecution + 1;545355 expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address});54 expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address});103102104 expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address});103 expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address});105104106 await token.scheduleAfter(waitForBlocks, {scheduledId})105 await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId})107 .transfer(alice, {Substrate: bob.address});106 .nft.transferToken(alice, collection.collectionId, token.tokenId, {Substrate: bob.address});108 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;107 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;109108110 await helper.scheduler.cancelScheduled(alice, scheduledId);109 await helper.scheduler.cancelScheduled(alice, scheduledId);363 const scheduledId = helper.arrange.makeScheduledId();362 const scheduledId = helper.arrange.makeScheduledId();364 const waitForBlocks = 4;363 const waitForBlocks = 4;365364366 await token.scheduleAfter(waitForBlocks, {scheduledId})365 await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId})367 .transfer(bob, {Substrate: alice.address});366 .nft.transferToken(bob, collection.collectionId, token.tokenId, {Substrate: alice.address});368 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;367 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;369368370 await helper.getSudo().scheduler.cancelScheduled(superuser, scheduledId);369 await helper.getSudo().scheduler.cancelScheduled(superuser, scheduledId);404 const scheduledId = helper.arrange.makeScheduledId();403 const scheduledId = helper.arrange.makeScheduledId();405 const waitForBlocks = 6;404 const waitForBlocks = 6;406405407 await token.scheduleAfter(waitForBlocks, {scheduledId})406 await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId})408 .transfer(bob, {Substrate: alice.address});407 .nft.transferToken(bob, collection.collectionId, token.tokenId, {Substrate: alice.address});409 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;408 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;410409411 const priority = 112;410 const priority = 112;583 const scheduledId = helper.arrange.makeScheduledId();582 const scheduledId = helper.arrange.makeScheduledId();584 const waitForBlocks = 4;583 const waitForBlocks = 4;585584586 await token.scheduleAfter(waitForBlocks, {scheduledId})585 await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId})587 .transfer(alice, {Substrate: bob.address});586 .nft.transferToken(alice, collection.collectionId, token.tokenId, {Substrate: bob.address});588 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;587 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;589588590 const scheduled = helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId});589 const scheduled = helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId});614 const scheduledId = helper.arrange.makeScheduledId();613 const scheduledId = helper.arrange.makeScheduledId();615 const waitForBlocks = 4;614 const waitForBlocks = 4;616615617 await token.scheduleAfter(waitForBlocks, {scheduledId})616 await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId})618 .transfer(alice, {Substrate: bob.address});617 .nft.transferToken(alice, collection.collectionId, token.tokenId, {Substrate: bob.address});619 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;618 const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;620619621 await expect(helper.scheduler.cancelScheduled(bob, scheduledId))620 await expect(helper.scheduler.cancelScheduled(bob, scheduledId))655 const scheduledId = helper.arrange.makeScheduledId();654 const scheduledId = helper.arrange.makeScheduledId();656 const waitForBlocks = 4;655 const waitForBlocks = 4;657656658 await token.scheduleAfter(waitForBlocks, {scheduledId})657 await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId})659 .transfer(bob, {Substrate: alice.address});658 .nft.transferToken(bob, collection.collectionId, token.tokenId, {Substrate: alice.address});660659661 const priority = 112;660 const priority = 112;662 await expect(helper.scheduler.changePriority(alice, scheduledId, priority))661 await expect(helper.scheduler.changePriority(alice, scheduledId, priority))tests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth609 this.wait = new WaitGroup(this);609 this.wait = new WaitGroup(this);610 }610 }611611612 getSudo<T extends UniqueHelper>() {612 getSudo<T extends AstarHelper>() {613 // eslint-disable-next-line @typescript-eslint/naming-convention613 // eslint-disable-next-line @typescript-eslint/naming-convention614 const SudoHelperType = SudoHelper(this.helperBase);614 const SudoHelperType = SudoHelper(this.helperBase);615 return this.clone(SudoHelperType) as T;615 return this.clone(SudoHelperType) as T;636 super(logger, options);636 super(logger, options);637 this.wait = new WaitGroup(this);637 this.wait = new WaitGroup(this);638 }638 }639 getSudo<T extends UniqueHelper>() {639 getSudo<T extends AcalaHelper>() {640 // eslint-disable-next-line @typescript-eslint/naming-convention640 // eslint-disable-next-line @typescript-eslint/naming-convention641 const SudoHelperType = SudoHelper(this.helperBase);641 const SudoHelperType = SudoHelper(this.helperBase);642 return this.clone(SudoHelperType) as T;642 return this.clone(SudoHelperType) as T;