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.tsdiffbeforeafterboth--- a/tests/src/scheduler.seqtest.ts
+++ b/tests/src/scheduler.seqtest.ts
@@ -47,9 +47,8 @@
const token = await collection.mintToken(alice);
const scheduledId = scheduleKind == 'named' ? helper.arrange.makeScheduledId() : undefined;
const blocksBeforeExecution = 4;
-
- await token.scheduleAfter(blocksBeforeExecution, {scheduledId})
- .transfer(alice, {Substrate: bob.address});
+ await helper.scheduler.scheduleAfter(blocksBeforeExecution, {scheduledId})
+ .nft.transferToken(alice, collection.collectionId, token.tokenId, {Substrate: bob.address});
const executionBlock = await helper.chain.getLatestBlockNumber() + blocksBeforeExecution + 1;
expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address});
@@ -103,8 +102,8 @@
expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address});
- await token.scheduleAfter(waitForBlocks, {scheduledId})
- .transfer(alice, {Substrate: bob.address});
+ await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId})
+ .nft.transferToken(alice, collection.collectionId, token.tokenId, {Substrate: bob.address});
const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
await helper.scheduler.cancelScheduled(alice, scheduledId);
@@ -363,8 +362,8 @@
const scheduledId = helper.arrange.makeScheduledId();
const waitForBlocks = 4;
- await token.scheduleAfter(waitForBlocks, {scheduledId})
- .transfer(bob, {Substrate: alice.address});
+ await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId})
+ .nft.transferToken(bob, collection.collectionId, token.tokenId, {Substrate: alice.address});
const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
await helper.getSudo().scheduler.cancelScheduled(superuser, scheduledId);
@@ -404,8 +403,8 @@
const scheduledId = helper.arrange.makeScheduledId();
const waitForBlocks = 6;
- await token.scheduleAfter(waitForBlocks, {scheduledId})
- .transfer(bob, {Substrate: alice.address});
+ await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId})
+ .nft.transferToken(bob, collection.collectionId, token.tokenId, {Substrate: alice.address});
const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
const priority = 112;
@@ -583,8 +582,8 @@
const scheduledId = helper.arrange.makeScheduledId();
const waitForBlocks = 4;
- await token.scheduleAfter(waitForBlocks, {scheduledId})
- .transfer(alice, {Substrate: bob.address});
+ await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId})
+ .nft.transferToken(alice, collection.collectionId, token.tokenId, {Substrate: bob.address});
const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
const scheduled = helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId});
@@ -614,8 +613,8 @@
const scheduledId = helper.arrange.makeScheduledId();
const waitForBlocks = 4;
- await token.scheduleAfter(waitForBlocks, {scheduledId})
- .transfer(alice, {Substrate: bob.address});
+ await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId})
+ .nft.transferToken(alice, collection.collectionId, token.tokenId, {Substrate: bob.address});
const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1;
await expect(helper.scheduler.cancelScheduled(bob, scheduledId))
@@ -655,8 +654,8 @@
const scheduledId = helper.arrange.makeScheduledId();
const waitForBlocks = 4;
- await token.scheduleAfter(waitForBlocks, {scheduledId})
- .transfer(bob, {Substrate: alice.address});
+ await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId})
+ .nft.transferToken(bob, collection.collectionId, token.tokenId, {Substrate: alice.address});
const priority = 112;
await expect(helper.scheduler.changePriority(alice, scheduledId, priority))
tests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.dev.ts
+++ b/tests/src/util/playgrounds/unique.dev.ts
@@ -609,7 +609,7 @@
this.wait = new WaitGroup(this);
}
- getSudo<T extends UniqueHelper>() {
+ getSudo<T extends AstarHelper>() {
// eslint-disable-next-line @typescript-eslint/naming-convention
const SudoHelperType = SudoHelper(this.helperBase);
return this.clone(SudoHelperType) as T;
@@ -636,7 +636,7 @@
super(logger, options);
this.wait = new WaitGroup(this);
}
- getSudo<T extends UniqueHelper>() {
+ getSudo<T extends AcalaHelper>() {
// eslint-disable-next-line @typescript-eslint/naming-convention
const SudoHelperType = SudoHelper(this.helperBase);
return this.clone(SudoHelperType) as T;