diff --git a/packages/contracts/test/10_unit-testing/11_plugin.ts b/packages/contracts/test/token-voting/11_token-voting.ts similarity index 98% rename from packages/contracts/test/10_unit-testing/11_plugin.ts rename to packages/contracts/test/token-voting/11_token-voting.ts index 54180af1..f7b5aca5 100644 --- a/packages/contracts/test/10_unit-testing/11_plugin.ts +++ b/packages/contracts/test/token-voting/11_token-voting.ts @@ -208,6 +208,7 @@ describe('TokenVoting', function () { const {dao, initializedPlugin, defaultVotingSettings, token} = await loadFixture(globalFixture); + // await expect( initializedPlugin.initialize( dao.address, @@ -220,6 +221,8 @@ describe('TokenVoting', function () { it('emits the `MembershipContractAnnounced` event', async () => { const {dao, uninitializedPlugin, defaultVotingSettings, token} = await loadFixture(globalFixture); + + // Try to reinitialize the initialized plugin. await expect( await uninitializedPlugin.initialize( dao.address, @@ -235,31 +238,67 @@ describe('TokenVoting', function () { }); it('sets the voting settings', async () => { - const {initializedPlugin, defaultVotingSettings} = await loadFixture( - globalFixture + const { + dao, + uninitializedPlugin: plugin, + defaultVotingSettings, + token, + } = await loadFixture(globalFixture); + + // Check that the uninitialized plugin hasn't voting settings set yet. + expect(await plugin.minDuration()).to.equal(0); + expect(await plugin.minParticipation()).to.equal(0); + expect(await plugin.minProposerVotingPower()).to.equal(0); + expect(await plugin.supportThreshold()).to.equal(0); + expect(await plugin.votingMode()).to.equal(0); + + // Initialize the plugin. + await plugin.initialize( + dao.address, + defaultVotingSettings, + token.address ); - expect(await initializedPlugin.minDuration()).to.equal( + // Check that the voting settings have been set. + expect(await plugin.minDuration()).to.equal( defaultVotingSettings.minDuration ); - expect(await initializedPlugin.minParticipation()).to.equal( + expect(await plugin.minParticipation()).to.equal( defaultVotingSettings.minParticipation ); - expect(await initializedPlugin.minProposerVotingPower()).to.equal( + expect(await plugin.minProposerVotingPower()).to.equal( defaultVotingSettings.minProposerVotingPower ); - expect(await initializedPlugin.supportThreshold()).to.equal( + expect(await plugin.supportThreshold()).to.equal( defaultVotingSettings.supportThreshold ); - expect(await initializedPlugin.votingMode()).to.equal( + expect(await plugin.votingMode()).to.equal( defaultVotingSettings.votingMode ); }); it('sets the token', async () => { - const {initializedPlugin, token} = await loadFixture(globalFixture); + const { + dao, + uninitializedPlugin: plugin, + defaultVotingSettings, + token, + } = await loadFixture(globalFixture); + + // Check that the uninitialized plugin has not token set. + expect(await plugin.getVotingToken()).to.equal( + ethers.constants.AddressZero + ); + + // Initialize the plugin. + await plugin.initialize( + dao.address, + defaultVotingSettings, + token.address + ); - expect(await initializedPlugin.getVotingToken()).to.equal(token.address); + // Check that the token has been set. + expect(await plugin.getVotingToken()).to.equal(token.address); }); }); diff --git a/packages/contracts/test/10_unit-testing/12_plugin-setup.ts b/packages/contracts/test/token-voting/12_token-voting-setup.ts similarity index 100% rename from packages/contracts/test/10_unit-testing/12_plugin-setup.ts rename to packages/contracts/test/token-voting/12_token-voting-setup.ts diff --git a/packages/contracts/test/10_unit-testing/base/11_majority-voting.ts b/packages/contracts/test/token-voting/base/11_majority-voting.ts similarity index 100% rename from packages/contracts/test/10_unit-testing/base/11_majority-voting.ts rename to packages/contracts/test/token-voting/base/11_majority-voting.ts diff --git a/packages/contracts/test/10_unit-testing/token/11_governance-erc20.ts b/packages/contracts/test/token-voting/token/11_governance-erc20.ts similarity index 100% rename from packages/contracts/test/10_unit-testing/token/11_governance-erc20.ts rename to packages/contracts/test/token-voting/token/11_governance-erc20.ts diff --git a/packages/contracts/test/10_unit-testing/token/12_governance-wrapped-erc20.ts b/packages/contracts/test/token-voting/token/12_governance-wrapped-erc20.ts similarity index 100% rename from packages/contracts/test/10_unit-testing/token/12_governance-wrapped-erc20.ts rename to packages/contracts/test/token-voting/token/12_governance-wrapped-erc20.ts