git.delta.rocks / unique-network / refs/commits / 61a184132bb0

difftreelog

Fix tests

Maksandre2022-09-02parent: #65cd357.patch.diff
in: master
Moved up before hook
tx.promotion -> tx.appPromotion

1 file changed

modifiedtests/src/app-promotion.test.tsdiffbeforeafterboth
38const palletAddress = calculatePalleteAddress('appstake');38const palletAddress = calculatePalleteAddress('appstake');
39let accounts: IKeyringPair[] = [];39let accounts: IKeyringPair[] = [];
4040
41describe('app-promotions.stake extrinsic', () => {
42 before(async function () {41before(async function () {
43 await usingPlaygrounds(async (helper, privateKeyWrapper) => {42 await usingPlaygrounds(async (helper, privateKeyWrapper) => {
44 if (!getModuleNames(helper.api!).includes(Pallets.AppPromotion)) this.skip();43 if (!getModuleNames(helper.api!).includes(Pallets.AppPromotion)) this.skip();
52 });51 });
53 });52});
5453
54describe('app-promotions.stake extrinsic', () => {
55 it('should "lock" staking balance, add it to "staked" map, and increase "totalStaked" amount', async () => {55 it('should "lock" staking balance, add it to "staked" map, and increase "totalStaked" amount', async () => {
56 await usingPlaygrounds(async (helper) => {56 await usingPlaygrounds(async (helper) => {
57 const [staker, recepient] = [accounts.pop()!, accounts.pop()!];57 const [staker, recepient] = [accounts.pop()!, accounts.pop()!];
126 expect(crowdStakes).to.deep.equal([100n * nominal, 100n * nominal, 100n * nominal, 100n * nominal]);126 expect(crowdStakes).to.deep.equal([100n * nominal, 100n * nominal, 100n * nominal, 100n * nominal]);
127 });127 });
128 });128 });
129});129});
130130
131describe('unstake balance extrinsic', () => { 131describe('unstake balance extrinsic', () => {
132 it('should change balance state from "frozen" to "reserved", add it to "pendingUnstake" map, and subtract it from totalStaked', async () => {132 it('should change balance state from "frozen" to "reserved", add it to "pendingUnstake" map, and subtract it from totalStaked', async () => {
681 681
682 // so he did not receive any rewards682 // so he did not receive any rewards
683 const totalBalanceBefore = await helper.balance.getSubstrate(staker.address);683 const totalBalanceBefore = await helper.balance.getSubstrate(staker.address);
684 await helper.signTransaction(palletAdmin, helper.api!.tx.promotion.payoutStakers(100));684 await helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.payoutStakers(100));
685 const totalBalanceAfter = await helper.balance.getSubstrate(staker.address);685 const totalBalanceAfter = await helper.balance.getSubstrate(staker.address);
686686
687 expect(totalBalanceBefore).to.be.equal(totalBalanceAfter);687 expect(totalBalanceBefore).to.be.equal(totalBalanceAfter);