Update docs

This commit is contained in:
github-actions
2024-10-21 14:27:36 +00:00
parent 63bb51f17d
commit edf6031131
435 changed files with 42062 additions and 23945 deletions

View File

@ -1,26 +1,32 @@
const { time, constants, expectRevert } = require('@openzeppelin/test-helpers');
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.js');
} = require('../AccessControl.behavior');
const AccessControlDefaultAdminRules = artifacts.require('$AccessControlDefaultAdminRules');
contract('AccessControlDefaultAdminRules', function (accounts) {
const delay = web3.utils.toBN(time.duration.hours(10));
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 () {
this.accessControl = await AccessControlDefaultAdminRules.new(delay, accounts[0], { from: accounts[0] });
Object.assign(this, await loadFixture(fixture));
});
it('initial admin not zero', async function () {
await expectRevert(
AccessControlDefaultAdminRules.new(delay, constants.ZERO_ADDRESS),
'AccessControlInvalidDefaultAdmin',
[constants.ZERO_ADDRESS],
);
await expect(ethers.deployContract('$AccessControlDefaultAdminRules', [this.delay, ethers.ZeroAddress]))
.to.be.revertedWithCustomError(this.mock, 'AccessControlInvalidDefaultAdmin')
.withArgs(ethers.ZeroAddress);
});
shouldBehaveLikeAccessControl(...accounts);
shouldBehaveLikeAccessControlDefaultAdminRules(delay, ...accounts);
shouldBehaveLikeAccessControl();
shouldBehaveLikeAccessControlDefaultAdminRules();
});