diff --git a/packages/contracts/test/unit-testing/main-voting-plugin.ts b/packages/contracts/test/unit-testing/main-voting-plugin.ts index 98e84b5..6629f0c 100644 --- a/packages/contracts/test/unit-testing/main-voting-plugin.ts +++ b/packages/contracts/test/unit-testing/main-voting-plugin.ts @@ -1663,6 +1663,25 @@ describe('Main Voting Plugin', function () { }); }); + context('Joining a space via MemberAccessPlugin', () => { + it('Proposing new members via MemberAccess plugin grants membership', async () => { + expect(await mainVotingPlugin.isMember(carol.address)).to.be.false; + await mainVotingPlugin.proposeAddMember( + toUtf8Bytes('ipfs://'), + carol.address + ); + expect(await mainVotingPlugin.isMember(carol.address)).to.be.true; + + // 2 + expect(await mainVotingPlugin.isMember(ADDRESS_THREE)).to.be.false; + await mainVotingPlugin.proposeAddMember( + toUtf8Bytes('ipfs://'), + ADDRESS_THREE + ); + expect(await mainVotingPlugin.isMember(ADDRESS_THREE)).to.be.true; + }); + }); + context('Leaving a space', () => { it('Completely removes an editor', async () => { await makeEditor(bob.address); diff --git a/packages/contracts/test/unit-testing/member-access-plugin.ts b/packages/contracts/test/unit-testing/member-access-plugin.ts index aba26a9..4d7af09 100644 --- a/packages/contracts/test/unit-testing/member-access-plugin.ts +++ b/packages/contracts/test/unit-testing/member-access-plugin.ts @@ -170,7 +170,47 @@ describe('Member Access Plugin', function () { }); describe('Before approving', () => { - it('Allows any address to request membership', async () => { + it('Only addresses with PROPOSER_PERMISSION_ID can propose members', async () => { + // ok + await expect( + mainVotingPlugin.proposeAddMember(toUtf8Bytes('ipfs://'), carol.address) + ).to.not.be.reverted; + + await dao.revoke( + memberAccessPlugin.address, + mainVotingPlugin.address, + PROPOSER_PERMISSION_ID + ); + + // Now it fails + await expect( + mainVotingPlugin.proposeAddMember(toUtf8Bytes('ipfs://'), dave.address) + ).to.be.reverted; + }); + + it('Only callers implementing multisig can propose members', async () => { + // From a compatible plugin + await expect( + mainVotingPlugin.proposeAddMember(toUtf8Bytes('ipfs://'), carol.address) + ).to.not.be.reverted; + + await dao.grant( + memberAccessPlugin.address, + alice.address, + PROPOSER_PERMISSION_ID + ); + + // Fail despite the permission + await expect( + memberAccessPlugin.proposeAddMember( + toUtf8Bytes('ipfs://'), + dave.address, + alice.address + ) + ).to.be.reverted; + }); + + it('Allows any address to request membership via the MainVoting plugin', async () => { // Random expect(await mainVotingPlugin.isMember(carol.address)).to.be.false; pid = await memberAccessPlugin.proposalCount();