Skip to content

Commit

Permalink
Merge pull request #22 from aragon/feat/improve-coverage
Browse files Browse the repository at this point in the history
feat: improve coverage
  • Loading branch information
novaknole authored Nov 5, 2024
2 parents af77951 + 3814009 commit 4a3cbb9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
3 changes: 0 additions & 3 deletions packages/contracts/test/10_unit-testing/11_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,6 @@ describe('Multisig', function () {
).to.be.revertedWith('Initializable: contract is already initialized');
});

// todo add test for checking that plugins already initialized on a previous version can not be initialized again
it('reverts if trying to initialize lower version plugin');

it('sets the `_targetConfig` when initializing an uninitialized plugin', async () => {
const {uninitializedPlugin, deployer} = await loadFixture(fixture);

Expand Down
25 changes: 25 additions & 0 deletions packages/contracts/test/10_unit-testing/12_plugin-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,31 @@ describe('MultisigSetup', function () {
],
]);
});

it('returns the permissions expected for the update from build 3 (empty list)', async () => {
const {pluginSetup, dao, prepareUpdateBuild3Inputs} = await loadFixture(
fixture
);
const plugin = ethers.Wallet.createRandom().address;

// Make a static call to check that the plugin update data being returned is correct.
const {
initData: initData,
preparedSetupData: {helpers, permissions},
} = await pluginSetup.callStatic.prepareUpdate(dao.address, 3, {
currentHelpers: [
ethers.Wallet.createRandom().address,
ethers.Wallet.createRandom().address,
],
data: prepareUpdateBuild3Inputs,
plugin,
});

// Check the return data. There should be no permission needed for build 3.
expect(initData).to.be.eq('0x');
expect(permissions.length).to.be.equal(0);
expect(helpers.length).to.be.equal(0);
});
});

describe('prepareUninstallation', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from '../../typechain';
import {ProxyCreatedEvent} from '../../typechain/@aragon/osx-commons-contracts/src/utils/deployment/ProxyFactory';
import {PluginUUPSUpgradeable__factory} from '../../typechain/factories/@aragon/osx-v1.0.0/core/plugin';
import {latestPluginBuild} from '../multisig-constants';
import {
DAO_PERMISSIONS,
PLUGIN_SETUP_PROCESSOR_PERMISSIONS,
Expand Down Expand Up @@ -333,7 +334,7 @@ export async function updateFromBuildTest(
pluginSetupRefLatestBuild,
ethers.utils.defaultAbiCoder.encode(
getNamedTypesFromMetadata(
METADATA.build.pluginSetup.prepareUpdate[3].inputs
METADATA.build.pluginSetup.prepareUpdate[latestPluginBuild].inputs
),
updateInputs
)
Expand Down
1 change: 1 addition & 0 deletions packages/contracts/test/multisig-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ export type TargetConfig = {
};

export const latestInitializerVersion = 2;
export const latestPluginBuild = 3;

0 comments on commit 4a3cbb9

Please sign in to comment.