Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed Aug 14, 2024
1 parent c8cc8ae commit 543c851
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions packages/contracts/test/unit-testing/personal-admin-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
ROOT_PERMISSION_ID,
PROPOSER_PERMISSION_ID,
ADD_MEMBER_PERMISSION_ID,
mineBlock,
} from './common';
import {
DAO__factory,
Expand Down Expand Up @@ -123,14 +124,6 @@ describe('Personal Admin Plugin', function () {
await initializePAP(anticipatedHelperAddress);
await initializePMAH();

// Alice is editor
await dao.grant(
personalAdminPlugin.address,
alice.address,
EDITOR_PERMISSION_ID
);
// Bob is a member
await makeMember(bob.address);
// The plugin can execute on the DAO
await dao.grant(
dao.address,
Expand Down Expand Up @@ -160,6 +153,16 @@ describe('Personal Admin Plugin', function () {
await dao.grant(spacePlugin.address, dao.address, SUBSPACE_PERMISSION_ID);
// The DAO is root on itself
await dao.grant(dao.address, dao.address, ROOT_PERMISSION_ID);

// Alice is editor
await dao.grant(
personalAdminPlugin.address,
alice.address,
EDITOR_PERMISSION_ID
);
// Bob is a member
await mineBlock();
await makeMember(bob.address);
});

function initializePAP(helperAddr: string) {
Expand Down Expand Up @@ -318,15 +321,16 @@ describe('Personal Admin Plugin', function () {
it('Only editors can call permission proposal wrappers', async () => {
await expect(personalAdminPlugin.submitNewEditor(ADDRESS_TWO)).to.not.be
.reverted;
await expect(personalAdminPlugin.submitRemoveMember(ADDRESS_ONE)).to.not
.be.reverted;
await expect(personalAdminPlugin.submitRemoveEditor(ADDRESS_TWO)).to.not
.be.reverted;

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

await expect(personalAdminPlugin.submitRemoveMember(ADDRESS_ONE)).to.not
.be.reverted;

// Non editors
await expect(
personalAdminPlugin.connect(carol).submitNewEditor(ADDRESS_TWO)
Expand Down Expand Up @@ -362,7 +366,7 @@ describe('Personal Admin Plugin', function () {
);

expect(await personalAdminPlugin.proposalCount()).to.equal(
BigNumber.from(3)
BigNumber.from(2)
);
});

Expand Down

0 comments on commit 543c851

Please sign in to comment.