dexorder
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
const { ethers } = require('hardhat');
|
||||
const { expect } = require('chai');
|
||||
const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
|
||||
|
||||
const time = require('../../helpers/time');
|
||||
|
||||
const {
|
||||
shouldBehaveLikeAccessControl,
|
||||
shouldBehaveLikeAccessControlDefaultAdminRules,
|
||||
} = require('../AccessControl.behavior');
|
||||
|
||||
async function fixture() {
|
||||
const delay = time.duration.hours(10);
|
||||
const [defaultAdmin, ...accounts] = await ethers.getSigners();
|
||||
const mock = await ethers.deployContract('$AccessControlDefaultAdminRules', [delay, defaultAdmin]);
|
||||
return { mock, defaultAdmin, delay, accounts };
|
||||
}
|
||||
|
||||
describe('AccessControlDefaultAdminRules', function () {
|
||||
beforeEach(async function () {
|
||||
Object.assign(this, await loadFixture(fixture));
|
||||
});
|
||||
|
||||
it('initial admin not zero', async function () {
|
||||
await expect(ethers.deployContract('$AccessControlDefaultAdminRules', [this.delay, ethers.ZeroAddress]))
|
||||
.to.be.revertedWithCustomError(this.mock, 'AccessControlInvalidDefaultAdmin')
|
||||
.withArgs(ethers.ZeroAddress);
|
||||
});
|
||||
|
||||
shouldBehaveLikeAccessControl();
|
||||
shouldBehaveLikeAccessControlDefaultAdminRules();
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
const { ethers } = require('hardhat');
|
||||
const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
|
||||
|
||||
const {
|
||||
DEFAULT_ADMIN_ROLE,
|
||||
shouldBehaveLikeAccessControl,
|
||||
shouldBehaveLikeAccessControlEnumerable,
|
||||
} = require('../AccessControl.behavior');
|
||||
|
||||
async function fixture() {
|
||||
const [defaultAdmin, ...accounts] = await ethers.getSigners();
|
||||
const mock = await ethers.deployContract('$AccessControlEnumerable');
|
||||
await mock.$_grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin);
|
||||
return { mock, defaultAdmin, accounts };
|
||||
}
|
||||
|
||||
describe('AccessControlEnumerable', function () {
|
||||
beforeEach(async function () {
|
||||
Object.assign(this, await loadFixture(fixture));
|
||||
});
|
||||
|
||||
shouldBehaveLikeAccessControl();
|
||||
shouldBehaveLikeAccessControlEnumerable();
|
||||
});
|
||||
Reference in New Issue
Block a user