git.delta.rocks / unique-network / refs/commits / 8ca43b552b31

difftreelog

fix(scheduler) minimize wait time in test, comment sponsorship, remove unused imports

Daniel Shiposha2022-09-20parent: #51ae34f.patch.diff
in: master

1 file changed

modifiedtests/src/.outdated/scheduler.test.tsdiffbeforeafterboth
20 submitTransactionExpectFailAsync,20 submitTransactionExpectFailAsync,
21} from '../substrate/substrate-api';21} from '../substrate/substrate-api';
22import {22import {
23 createItemExpectSuccess,
24 createCollectionExpectSuccess,
25 scheduleTransferExpectSuccess,
26 setCollectionSponsorExpectSuccess,
27 confirmSponsorshipExpectSuccess,
28 findUnusedAddress,
29 UNIQUE,23 UNIQUE,
30 enablePublicMintingExpectSuccess,
31 addToAllowListExpectSuccess,
32 waitNewBlocks,24 waitNewBlocks,
33 normalizeAccountId,
34 getTokenOwner,
35 getGenericResult,
36 getFreeBalance,
37 confirmSponsorshipByKeyExpectSuccess,
38 scheduleExpectFailure,
39 scheduleAfter,
40} from './util/helpers';25} from './util/helpers';
41import {expect, itSub, Pallets, usingPlaygrounds} from './util/playgrounds';26import {expect, itSub, Pallets, usingPlaygrounds} from './util/playgrounds';
42import {IKeyringPair} from '@polkadot/types/types';27import {IKeyringPair} from '@polkadot/types/types';
191176
192 itSub.ifWithPallets('Scheduled tasks should take correct fees', [Pallets.Scheduler, Pallets.TestUtils], async function({helper}) {177 itSub.ifWithPallets('Scheduled tasks should take correct fees', [Pallets.Scheduler, Pallets.TestUtils], async function({helper}) {
193 const scheduledId = await helper.arrange.makeScheduledId();178 const scheduledId = await helper.arrange.makeScheduledId();
194 const waitForBlocks = 8;179 const waitForBlocks = 4;
195 const periodic = {180 const periodic = {
196 period: 2,181 period: 2,
197 repetitions: 2,182 repetitions: 2,
304289
305 itSub.ifWithPallets('A scheduled operation can cancel itself', [Pallets.Scheduler, Pallets.TestUtils], async ({helper}) => {290 itSub.ifWithPallets('A scheduled operation can cancel itself', [Pallets.Scheduler, Pallets.TestUtils], async ({helper}) => {
306 const scheduledId = await helper.arrange.makeScheduledId();291 const scheduledId = await helper.arrange.makeScheduledId();
307 const waitForBlocks = 8;292 const waitForBlocks = 4;
308 const periodic = {293 const periodic = {
309 period: 2,294 period: 2,
310 repetitions: 5,295 repetitions: 5,
391 const token = await collection.mintToken(bob);376 const token = await collection.mintToken(bob);
392377
393 const scheduledId = await helper.arrange.makeScheduledId();378 const scheduledId = await helper.arrange.makeScheduledId();
394 const waitForBlocks = 4;379 const waitForBlocks = 6;
395380
396 await token.scheduleAfter(scheduledId, waitForBlocks)381 await token.scheduleAfter(scheduledId, waitForBlocks)
397 .transfer(bob, {Substrate: alice.address});382 .transfer(bob, {Substrate: alice.address});
423 const prioLow = 255;408 const prioLow = 255;
424409
425 const periodic = {410 const periodic = {
426 period: 8,411 period: 6,
427 repetitions: 2,412 repetitions: 2,
428 };413 };
429414
508 const token = await collection.mintToken(alice);493 const token = await collection.mintToken(alice);
509494
510 const scheduledId = await helper.arrange.makeScheduledId();495 const scheduledId = await helper.arrange.makeScheduledId();
511 const waitForBlocks = 8;496 const waitForBlocks = 4;
512497
513 await token.scheduleAfter(scheduledId, waitForBlocks)498 await token.scheduleAfter(scheduledId, waitForBlocks)
514 .transfer(alice, {Substrate: bob.address});499 .transfer(alice, {Substrate: bob.address});
567552
568// Implementation of the functionality tested here was postponed/shelved553// Implementation of the functionality tested here was postponed/shelved
569describe.skip('Sponsoring scheduling', () => {554describe.skip('Sponsoring scheduling', () => {
570 let alice: IKeyringPair;555 // let alice: IKeyringPair;
571 let bob: IKeyringPair;556 // let bob: IKeyringPair;
572557
573 before(async() => {558 // before(async() => {
574 await usingApi(async (_, privateKeyWrapper) => {559 // await usingApi(async (_, privateKeyWrapper) => {
575 alice = privateKeyWrapper('//Alice');560 // alice = privateKeyWrapper('//Alice');
576 bob = privateKeyWrapper('//Bob');561 // bob = privateKeyWrapper('//Bob');
577 });562 // });
578 });563 // });
579564
580 it('Can sponsor scheduling a transaction', async () => {565 it('Can sponsor scheduling a transaction', async () => {
581 // const collectionId = await createCollectionExpectSuccess();566 // const collectionId = await createCollectionExpectSuccess();