Skip to content

Commit

Permalink
Minor test adaptation
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed May 7, 2024
1 parent 3e17e9f commit e1a3010
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions packages/contracts/test/unit-testing/main-voting-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
import {deployTestDao} from '../helpers/test-dao';
import {
ADDRESS_ONE,
ADDRESS_THREE,
ADDRESS_TWO,
ADDRESS_ZERO,
advanceAfterVoteEnd,
Expand All @@ -44,6 +45,7 @@ import {
import {defaultMainVotingSettings} from './common';
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
import {expect} from 'chai';
import {BigNumber} from 'ethers';
import {toUtf8Bytes} from 'ethers/lib/utils';
import {ethers} from 'hardhat';

Expand Down Expand Up @@ -252,6 +254,54 @@ describe('Main Voting Plugin', function () {
.withArgs(dave.address);
});

it('Only members can call proposal creation wrappers', async () => {
await expect(
mainVotingPlugin
.connect(alice)
.proposeEdits('ipfs://', spacePlugin.address)
).to.not.be.reverted;

await expect(
mainVotingPlugin
.connect(bob)
.proposeAcceptSubspace(ADDRESS_TWO, spacePlugin.address)
).to.not.be.reverted;

await expect(
mainVotingPlugin
.connect(bob)
.proposeRemoveSubspace(ADDRESS_THREE, spacePlugin.address)
).to.not.be.reverted;

expect(await mainVotingPlugin.proposalCount()).to.equal(
BigNumber.from(3)
);

await expect(
mainVotingPlugin
.connect(carol)
.proposeEdits('ipfs://', spacePlugin.address)
)
.to.be.revertedWithCustomError(mainVotingPlugin, 'NotAMember')
.withArgs(carol.address);

await expect(
mainVotingPlugin
.connect(dave)
.proposeAcceptSubspace(ADDRESS_TWO, spacePlugin.address)
)
.to.be.revertedWithCustomError(mainVotingPlugin, 'NotAMember')
.withArgs(dave.address);

await expect(
mainVotingPlugin
.connect(dave)
.proposeRemoveSubspace(ADDRESS_TWO, spacePlugin.address)
)
.to.be.revertedWithCustomError(mainVotingPlugin, 'NotAMember')
.withArgs(dave.address);
});

it('Only editors can vote on proposals', async () => {
await expect(
mainVotingPlugin.connect(bob).createProposal(
Expand Down

0 comments on commit e1a3010

Please sign in to comment.