--- a/tests/src/app-promotion.test.ts +++ b/tests/src/app-promotion.test.ts @@ -31,7 +31,6 @@ before(async function () { await usingPlaygrounds(async (helper, privateKey) => { requirePalletsOrSkip(this, helper, [Pallets.AppPromotion]); - const alice = await privateKey('//Alice'); donor = await privateKey({filename: __filename}); palletAddress = helper.arrange.calculatePalletAddress('appstake'); palletAdmin = await privateKey('//PromotionAdmin'); @@ -40,8 +39,6 @@ const accountBalances = new Array(100); accountBalances.fill(1000n); accounts = await helper.arrange.createAccounts(accountBalances, donor); // create accounts-pool to speed up tests - const api = helper.getApi(); - await helper.executeExtrinsic(alice, 'api.tx.sudo.sudo', [api.tx.configuration.setAppPromotionConfigurationOverride({recalculationInterval: LOCKING_PERIOD, pendingInterval: UNLOCKING_PERIOD})], true); }); }); --- a/tests/src/util/globalSetup.ts +++ b/tests/src/util/globalSetup.ts @@ -18,9 +18,13 @@ if (!result) Promise.reject(); }); - // 3. Set up App Promotion admin + // 3. Configure App Promotion const missingPallets = helper.fetchMissingPalletNames([Pallets.AppPromotion]); if (missingPallets.length === 0) { + // TODO: move to config file + const LOCKING_PERIOD = 8n; // 8 blocks of relay + const UNLOCKING_PERIOD = 4n; // 4 blocks of parachain + const superuser = await privateKey('//Alice'); const palletAddress = helper.arrange.calculatePalletAddress('appstake'); const palletAdmin = await privateKey('//PromotionAdmin'); @@ -29,6 +33,10 @@ const nominal = helper.balance.getOneTokenNominal(); await helper.balance.transferToSubstrate(superuser, palletAdmin.address, 1000n * nominal); await helper.balance.transferToSubstrate(superuser, palletAddress, 1000n * nominal); + await helper.executeExtrinsic(superuser, 'api.tx.sudo.sudo', [api.tx.configuration + .setAppPromotionConfigurationOverride({ + recalculationInterval: LOCKING_PERIOD, + pendingInterval: UNLOCKING_PERIOD})], true); } } catch (error) { console.error(error);