Add tests to extend code coverage (#2586)

This commit is contained in:
Hadrien Croubois
2021-03-15 17:01:47 +01:00
committed by GitHub
parent d5194725b7
commit cd443f0d5b
8 changed files with 91 additions and 11 deletions

View File

@ -368,6 +368,36 @@ contract('TimelockController', function (accounts) {
);
});
it('length of batch parameter must match #1', async function () {
await expectRevert(
this.timelock.scheduleBatch(
this.operation.targets,
[],
this.operation.datas,
this.operation.predecessor,
this.operation.salt,
MINDELAY,
{ from: proposer },
),
'TimelockController: length mismatch',
);
});
it('length of batch parameter must match #1', async function () {
await expectRevert(
this.timelock.scheduleBatch(
this.operation.targets,
this.operation.values,
[],
this.operation.predecessor,
this.operation.salt,
MINDELAY,
{ from: proposer },
),
'TimelockController: length mismatch',
);
});
it('prevent non-proposer from commiting', async function () {
await expectRevert(
this.timelock.scheduleBatch(
@ -623,6 +653,13 @@ contract('TimelockController', function (accounts) {
expectEvent(receipt, 'Cancelled', { id: this.operation.id });
});
it('cannot cancel invalid operation', async function () {
await expectRevert(
this.timelock.cancel(constants.ZERO_BYTES32, { from: proposer }),
'TimelockController: operation cannot be cancelled',
);
});
it('prevent non-proposer from canceling', async function () {
await expectRevert(
this.timelock.cancel(this.operation.id, { from: other }),