Skip to content

Commit

Permalink
Adapting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jør∂¡ committed Jun 5, 2024
1 parent b8a7ef5 commit 43f9a3d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ describe('Member Access Condition', function () {
});
});

describe('Direct add are not allowed', () => {
describe("Direct add's are not allowed", () => {
it('Should reject adding and removing directly, rather than executing', async () => {
// Valid
expect(
Expand Down
40 changes: 7 additions & 33 deletions packages/contracts/test/unit-testing/member-access-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export const defaultInitData: InitData = {

export const multisigInterface = new ethers.utils.Interface([
'function initialize(address,tuple(uint64,address))',
'function updateMultisigSettings(tuple(uint64,address))',
'function proposeNewMember(bytes,address)',
'function updateMultisigSettings(tuple(uint64))',
'function proposeAddMember(bytes,address,address)',
'function getProposal(uint256)',
]);
const mainVotingPluginInterface = MainVotingPlugin__factory.createInterface();
Expand Down Expand Up @@ -763,15 +763,15 @@ describe('Member Access Plugin', function () {
.connect(dave)
.proposeAddMember(toUtf8Bytes('ipfs://1234'), alice.address)
)
.to.be.revertedWithCustomError(memberAccessPlugin, 'AlreadyMember')
.to.be.revertedWithCustomError(mainVotingPlugin, 'AlreadyAMember')
.withArgs(alice.address);

await expect(
mainVotingPlugin
.connect(dave)
.proposeAddMember(toUtf8Bytes('ipfs://1234'), bob.address)
)
.to.be.revertedWithCustomError(memberAccessPlugin, 'AlreadyMember')
.to.be.revertedWithCustomError(mainVotingPlugin, 'AlreadyAMember')
.withArgs(bob.address);
});

Expand Down Expand Up @@ -843,32 +843,6 @@ describe('Member Access Plugin', function () {
await expect(memberAccessPlugin.execute(pid)).to.be.reverted;
});

it('Fails to update the settings to use an incompatible main voting plugin', async () => {
const actionsWith = (days: number) => {
return [
{
to: memberAccessPlugin.address,
value: 0,
data: MemberAccessPlugin__factory.createInterface().encodeFunctionData(
'updateMultisigSettings',
[
{
proposalDuration: 60 * 60 * 24 * days,
},
]
),
},
] as IDAO.ActionStruct[];
};

await expect(dao.execute(ZERO_BYTES32, actionsWith(1), 0)).to.be.reverted;
await expect(dao.execute(ZERO_BYTES32, actionsWith(4), 0)).to.be.reverted;
await expect(dao.execute(ZERO_BYTES32, actionsWith(10), 0)).to.be
.reverted;
await expect(dao.execute(ZERO_BYTES32, actionsWith(222), 0)).to.be
.reverted;
});

it('Only the DAO can call the plugin to update the settings', async () => {
// Nobody else can
await expect(
Expand Down Expand Up @@ -983,7 +957,7 @@ describe('Member Access Plugin', function () {
memberAccessPlugin.initialize(dao.address, multisigSettings)
)
.to.emit(memberAccessPlugin, 'MultisigSettingsUpdated')
.withArgs(60 * 60 * 24 * 5, mainVotingPlugin.address);
.withArgs(60 * 60 * 24 * 5);
});
});

Expand Down Expand Up @@ -1045,7 +1019,7 @@ describe('Member Access Plugin', function () {
memberAccessPlugin.updateMultisigSettings(multisigSettings)
)
.to.emit(memberAccessPlugin, 'MultisigSettingsUpdated')
.withArgs(60 * 60 * 24 * 5, mainVotingPlugin.address);
.withArgs(60 * 60 * 24 * 5);
});
});

Expand Down Expand Up @@ -1119,7 +1093,7 @@ describe('Member Access Plugin', function () {
)
.to.revertedWithCustomError(
memberAccessPlugin,
'ProposalCreationForbidden'
'ProposalCreationForbiddenOnSameBlock'
)
.withArgs(alice.address);

Expand Down

0 comments on commit 43f9a3d

Please sign in to comment.