Cleanup the structure of GovernorTimelockControl.test.js (#4302)

This commit is contained in:
Hadrien Croubois
2023-06-14 16:00:38 +02:00
committed by GitHub
parent 604025400f
commit 7cc2cbfeb5

View File

@ -130,32 +130,6 @@ contract('GovernorTimelockControl', function (accounts) {
await expectEvent.inTransaction(txExecute.tx, this.receiver, 'MockFunctionCalled'); await expectEvent.inTransaction(txExecute.tx, this.receiver, 'MockFunctionCalled');
}); });
describe('should revert', function () {
describe('on queue', function () {
it('if already queued', async function () {
await this.helper.propose();
await this.helper.waitForSnapshot();
await this.helper.vote({ support: Enums.VoteType.For }, { from: voter1 });
await this.helper.vote({ support: Enums.VoteType.For }, { from: voter2 });
await this.helper.vote({ support: Enums.VoteType.Against }, { from: voter3 });
await this.helper.vote({ support: Enums.VoteType.Abstain }, { from: voter4 });
await this.helper.waitForDeadline();
const txQueue = await this.helper.queue();
await this.helper.waitForEta();
const txExecute = await this.helper.execute();
expectEvent(txQueue, 'ProposalQueued', { proposalId: this.proposal.id });
await expectEvent.inTransaction(txQueue.tx, this.timelock, 'CallScheduled', {
id: this.proposal.timelockid,
});
expectEvent(txExecute, 'ProposalExecuted', { proposalId: this.proposal.id });
await expectEvent.inTransaction(txExecute.tx, this.timelock, 'CallExecuted', {
id: this.proposal.timelockid,
});
await expectEvent.inTransaction(txExecute.tx, this.receiver, 'MockFunctionCalled');
});
describe('should revert', function () { describe('should revert', function () {
describe('on queue', function () { describe('on queue', function () {
it('if already queued', async function () { it('if already queued', async function () {
@ -368,9 +342,7 @@ contract('GovernorTimelockControl', function (accounts) {
await this.helper.waitForEta(); await this.helper.waitForEta();
await this.helper.execute(); await this.helper.execute();
expect(await web3.eth.getBalance(this.timelock.address)).to.be.bignumber.equal( expect(await web3.eth.getBalance(this.timelock.address)).to.be.bignumber.equal(timelockBalance.sub(t2g));
timelockBalance.sub(t2g),
);
expect(await web3.eth.getBalance(this.mock.address)).to.be.bignumber.equal(t2g.sub(g2o)); expect(await web3.eth.getBalance(this.mock.address)).to.be.bignumber.equal(t2g.sub(g2o));
expect(await web3.eth.getBalance(other)).to.be.bignumber.equal(otherBalance.add(g2o)); expect(await web3.eth.getBalance(other)).to.be.bignumber.equal(otherBalance.add(g2o));
}); });
@ -466,7 +438,5 @@ contract('GovernorTimelockControl', function (accounts) {
// then coverage reports. // then coverage reports.
}); });
}); });
});
});
} }
}); });