From 05c81ca4ae1fb9745cefd84c51de2f6e997ba1a1 Mon Sep 17 00:00:00 2001 From: Daniel Shiposha Date: Tue, 18 Jun 2024 19:45:53 +0200 Subject: [PATCH] fix: gov tests polkadot 1.9 update --- .../tests/sub/governance/council.test.ts | 18 +++++----- .../sub/governance/technicalCommittee.test.ts | 33 ++++++++++++++++--- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/js-packages/tests/sub/governance/council.test.ts b/js-packages/tests/sub/governance/council.test.ts index d05f7ea696..d963370276 100644 --- a/js-packages/tests/sub/governance/council.test.ts +++ b/js-packages/tests/sub/governance/council.test.ts @@ -211,14 +211,14 @@ describeGov('Governance: Council tests', () => { expect(finCouncilMembers).to.contains(newFinCouncilMember.address); }); - itSub.skip('Council member can add Fellowship member', async ({helper}) => { + itSub('Council member can add Fellowship member', async ({helper}) => { const newFellowshipMember = helper.arrange.createEmptyAccount(); await expect(helper.council.collective.execute( counselors.alex, helper.fellowship.collective.addMemberCall(newFellowshipMember.address), )).to.be.fulfilled; - const fellowshipMembers = (await helper.callRpc('api.query.fellowshipCollective.members')).toJSON(); - expect(fellowshipMembers).to.contains(newFellowshipMember.address); + expect(await helper.fellowship.collective.getMembers()).to.be.deep.contain(newFellowshipMember.address); + await clearFellowship(sudoer); }); itSub('>50% Council can promote Fellowship member', async ({helper}) => { @@ -246,16 +246,14 @@ describeGov('Governance: Council tests', () => { await clearFellowship(sudoer); }); - itSub('>50% Council can add\remove Fellowship member', async ({helper}) => { + itSub('>50% Council can remove Fellowship member', async ({helper}) => { try { - const newMember = helper.arrange.createEmptyAccount(); + const fellowship = await initFellowship(donor, sudoer); + const memberRank6 = fellowship[6][0]; - const proposalAdd = helper.fellowship.collective.addMemberCall(newMember.address); - const proposalRemove = helper.fellowship.collective.removeMemberCall(newMember.address, fellowshipRankLimit); - await expect(proposalFromMoreThanHalfCouncil(proposalAdd)).to.be.fulfilled; - expect(await helper.fellowship.collective.getMembers()).to.be.deep.contain(newMember.address); + const proposalRemove = helper.fellowship.collective.removeMemberCall(memberRank6.address, fellowshipRankLimit); await expect(proposalFromMoreThanHalfCouncil(proposalRemove)).to.be.fulfilled; - expect(await helper.fellowship.collective.getMembers()).to.be.not.deep.contain(newMember.address); + expect(await helper.fellowship.collective.getMembers()).to.be.not.deep.contain(memberRank6.address); } finally { await clearFellowship(sudoer); diff --git a/js-packages/tests/sub/governance/technicalCommittee.test.ts b/js-packages/tests/sub/governance/technicalCommittee.test.ts index d1fcf1a837..2dea4ef70e 100644 --- a/js-packages/tests/sub/governance/technicalCommittee.test.ts +++ b/js-packages/tests/sub/governance/technicalCommittee.test.ts @@ -119,14 +119,13 @@ describeGov('Governance: Technical Committee tests', () => { Event.FellowshipReferenda.Cancelled.expect(cancelProposal); }); - itSub.skip('TechComm member can add a Fellowship member', async ({helper}) => { + itSub('TechComm member can add a Fellowship member', async ({helper}) => { const newFellowshipMember = helper.arrange.createEmptyAccount(); await expect(helper.technicalCommittee.collective.execute( techcomms.andy, helper.fellowship.collective.addMemberCall(newFellowshipMember.address), )).to.be.fulfilled; - const fellowshipMembers = (await helper.callRpc('api.query.fellowshipCollective.members')).toJSON(); - expect(fellowshipMembers).to.contains(newFellowshipMember.address); + expect(await helper.fellowship.collective.getMembers()).to.be.deep.contain(newFellowshipMember.address); await clearFellowship(sudoer); }); @@ -235,12 +234,36 @@ describeGov('Governance: Technical Committee tests', () => { }); - itSub.skip('[Negative] TechComm cannot promote/demote Fellowship member', async () => { + itSub('[Negative] TechComm cannot promote/demote Fellowship member', async ({helper}) => { + const fellowship = await initFellowship(donor, sudoer); + const memberWithRankOne = fellowship[1][0]; + + const promoteProposal = helper.fellowship.collective.promoteCall(memberWithRankOne.address); + await expect(proposalFromAllCommittee(promoteProposal)).rejectedWith('BadOrigin'); + const demoteProposal = helper.fellowship.collective.demoteCall(memberWithRankOne.address); + await expect(proposalFromAllCommittee(demoteProposal)).rejectedWith('BadOrigin'); + + await clearFellowship(sudoer); }); - itSub.skip('[Negative] TechComm member cannot promote/demote Fellowship member', async () => { + itSub('[Negative] TechComm member cannot promote/demote Fellowship member', async ({helper}) => { + const fellowship = await initFellowship(donor, sudoer); + const memberWithRankOne = fellowship[1][0]; + + const promoteProposal = helper.fellowship.collective.promoteCall(memberWithRankOne.address); + await expect(helper.technicalCommittee.collective.execute( + techcomms.andy, + promoteProposal, + )).to.be.rejectedWith('BadOrigin'); + + const demoteProposal = helper.fellowship.collective.demoteCall(memberWithRankOne.address); + await expect(helper.technicalCommittee.collective.execute( + techcomms.andy, + demoteProposal, + )).to.be.rejectedWith('BadOrigin'); + await clearFellowship(sudoer); }); itSub('[Negative] TechComm cannot add/remove a Council member', async ({helper}) => {