difftreelog
Make previousCalculatedRecord eq None before tests
in: master
1 file changed
tests/src/sub/appPromotion/appPromotion.test.tsdiffbeforeafterboth71 await Promise.all(unstakeTxs);71 await Promise.all(unstakeTxs);72 usedAccounts = [];72 usedAccounts = [];73 expect(await helper.staking.getTotalStaked()).to.eq(0n); // there are no active stakes after each test73 expect(await helper.staking.getTotalStaked()).to.eq(0n); // there are no active stakes after each test74 // Make sure previousCalculatedRecord is None to avoid problem with payout stakers;75 await helper.admin.payoutStakers(palletAdmin, 100);76 expect((await helper.getApi().query.appPromotion.previousCalculatedRecord() as any).isNone).to.be.true;74 });77 });75 });78 });7679784 const [stakedInBlock] = await helper.staking.getTotalStakedPerBlock({Substrate: staker.address});787 const [stakedInBlock] = await helper.staking.getTotalStakedPerBlock({Substrate: staker.address});785 await helper.wait.forRelayBlockNumber(rewardAvailableInBlock(stakedInBlock.block));788 await helper.wait.forRelayBlockNumber(rewardAvailableInBlock(stakedInBlock.block));789790 const payout = await helper.admin.payoutStakers(palletAdmin, 100);786 const totalPayout = (await helper.admin.payoutStakers(palletAdmin, 100)).reduce((prev, payout) => prev + payout.payout, 0n);791 const totalPayout = payout.reduce((prev, payout) => prev + payout.payout, 0n);792 const stakerReward = payout.find(p => p.staker === staker.address);793794 expect(stakerReward?.payout).to.eq(calculateIncome(100n * nominal) - (100n * nominal));787795788 const totalStakedAfter = await helper.staking.getTotalStaked();796 const totalStakedAfter = await helper.staking.getTotalStaked();789 expect(totalStakedAfter).to.equal(totalStakedBefore + (100n * nominal) + totalPayout);797 expect(totalStakedAfter).to.equal(totalStakedBefore + (100n * nominal) + totalPayout);