Skip to content

Commit ad20602

Browse files
committed
update tests
1 parent 358b0e5 commit ad20602

File tree

2 files changed

+29
-22
lines changed

2 files changed

+29
-22
lines changed

test/governance/Governor.test.js

+26-22
Original file line numberDiff line numberDiff line change
@@ -198,31 +198,35 @@ describe('Governor', function () {
198198
});
199199

200200
describe('vote with signature', function () {
201-
it('votes with an EOA signature', async function () {
201+
it('votes with an EOA signature on two proposals', async function () {
202202
await this.token.connect(this.voter1).delegate(this.userEOA);
203203

204-
const nonce = await this.mock.nonces(this.userEOA);
205-
206-
// Run proposal
207-
await this.helper.propose();
208-
await this.helper.waitForSnapshot();
209-
await expect(
210-
this.helper.vote({
211-
support: VoteType.For,
212-
voter: this.userEOA.address,
213-
nonce,
214-
signature: signBallot(this.userEOA),
215-
}),
216-
)
217-
.to.emit(this.mock, 'VoteCast')
218-
.withArgs(this.userEOA, this.proposal.id, VoteType.For, ethers.parseEther('10'), '');
219-
220-
await this.helper.waitForDeadline();
221-
await this.helper.execute();
204+
for (let i = 0; i < 2; i++) {
205+
const nonce = await this.mock.nonces(this.userEOA);
222206

223-
// After
224-
expect(await this.mock.hasVoted(this.proposal.id, this.userEOA)).to.be.true;
225-
expect(await this.mock.nonces(this.userEOA)).to.equal(nonce + 1n);
207+
// Run proposal
208+
await this.helper.propose();
209+
await this.helper.waitForSnapshot();
210+
await expect(
211+
this.helper.vote({
212+
support: VoteType.For,
213+
voter: this.userEOA.address,
214+
nonce,
215+
signature: signBallot(this.userEOA),
216+
}),
217+
)
218+
.to.emit(this.mock, 'VoteCast')
219+
.withArgs(this.userEOA, this.proposal.id, VoteType.For, ethers.parseEther('10'), '');
220+
221+
// After
222+
expect(await this.mock.hasVoted(this.proposal.id, this.userEOA)).to.be.true;
223+
expect(await this.mock.nonces(this.userEOA)).to.equal(nonce + 1n);
224+
225+
// Update proposal to allow for re-propose
226+
this.helper.description += ' - updated';
227+
}
228+
229+
await expect(this.mock.nonces(this.userEOA)).to.eventually.equal(2n);
226230
});
227231

228232
it('votes with a valid EIP-1271 signature', async function () {

test/governance/extensions/GovernorNoncesKeyed.test.js

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
55
const { GovernorHelper } = require('../../helpers/governance');
66
const { getDomain, Ballot, ExtendedBallot } = require('../../helpers/eip712');
77
const { VoteType } = require('../../helpers/enums');
8+
const { shouldBehaveLikeNoncesKeyed } = require('../../utils/Nonces.behavior');
89

910
const TOKENS = [
1011
{ Token: '$ERC20Votes', mode: 'blocknumber' },
@@ -245,6 +246,8 @@ describe('GovernorNoncesKeyed', function () {
245246
});
246247
}
247248
});
249+
250+
shouldBehaveLikeNoncesKeyed();
248251
});
249252
}
250253
});

0 commit comments

Comments
 (0)