AccessManager tests consolidation (#4655)

This commit is contained in:
Ernesto García
2023-10-12 11:32:30 -06:00
committed by GitHub
parent b48d658228
commit 6383299d71
8 changed files with 843 additions and 713 deletions

View File

@ -53,22 +53,19 @@ contract('AuthorityUtils', function (accounts) {
describe('when authority replies with a delay', function () {
beforeEach(async function () {
this.authority = await AuthorityDelayMock.new();
this.immediate = true;
this.delay = web3.utils.toBN(42);
await this.authority._setImmediate(this.immediate);
await this.authority._setDelay(this.delay);
});
it('returns (immediate, delay)', async function () {
const { immediate, delay } = await this.mock.$canCallWithDelay(
this.authority.address,
user,
other,
'0x12345678',
);
expect(immediate).to.equal(this.immediate);
expect(delay).to.be.bignumber.equal(this.delay);
});
for (const immediate of [true, false]) {
for (const delay of ['0', '42']) {
it(`returns (immediate=${immediate}, delay=${delay})`, async function () {
await this.authority._setImmediate(immediate);
await this.authority._setDelay(delay);
const result = await this.mock.$canCallWithDelay(this.authority.address, user, other, '0x12345678');
expect(result.immediate).to.equal(immediate);
expect(result.delay).to.be.bignumber.equal(delay);
});
}
}
});
describe('when authority replies with empty data', function () {