difftreelog
Move app promotion configuration to globalSetup
in: master
2 files changed
tests/src/app-promotion.test.tsdiffbeforeafterboth--- 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);
});
});
tests/src/util/globalSetup.tsdiffbeforeafterboth18 if (!result) Promise.reject();18 if (!result) Promise.reject();19 });19 });202021 // 3. Set up App Promotion admin 21 // 3. Configure App Promotion 22 const missingPallets = helper.fetchMissingPalletNames([Pallets.AppPromotion]);22 const missingPallets = helper.fetchMissingPalletNames([Pallets.AppPromotion]);23 if (missingPallets.length === 0) {23 if (missingPallets.length === 0) {24 // TODO: move to config file25 const LOCKING_PERIOD = 8n; // 8 blocks of relay26 const UNLOCKING_PERIOD = 4n; // 4 blocks of parachain2724 const superuser = await privateKey('//Alice');28 const superuser = await privateKey('//Alice');25 const palletAddress = helper.arrange.calculatePalletAddress('appstake');29 const palletAddress = helper.arrange.calculatePalletAddress('appstake');29 const nominal = helper.balance.getOneTokenNominal();33 const nominal = helper.balance.getOneTokenNominal();30 await helper.balance.transferToSubstrate(superuser, palletAdmin.address, 1000n * nominal);34 await helper.balance.transferToSubstrate(superuser, palletAdmin.address, 1000n * nominal);31 await helper.balance.transferToSubstrate(superuser, palletAddress, 1000n * nominal);35 await helper.balance.transferToSubstrate(superuser, palletAddress, 1000n * nominal);36 await helper.executeExtrinsic(superuser, 'api.tx.sudo.sudo', [api.tx.configuration37 .setAppPromotionConfigurationOverride({38 recalculationInterval: LOCKING_PERIOD,39 pendingInterval: UNLOCKING_PERIOD})], true);32 }40 }33 } catch (error) {41 } catch (error) {34 console.error(error);42 console.error(error);