Remove async from describe blocks and add missing await in tests (#4942)
Co-authored-by: ernestognw <ernestognw@gmail.com> Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
@ -6,8 +6,9 @@ const { getAddressInSlot, ImplementationSlot } = require('../helpers/storage');
|
||||
module.exports = function shouldBehaveLikeProxy() {
|
||||
it('cannot be initialized with a non-contract address', async function () {
|
||||
const initializeData = '0x';
|
||||
const contractFactory = await ethers.getContractFactory('ERC1967Proxy');
|
||||
await expect(this.createProxy(this.nonContractAddress, initializeData))
|
||||
.to.be.revertedWithCustomError(await ethers.getContractFactory('ERC1967Proxy'), 'ERC1967InvalidImplementation')
|
||||
.to.be.revertedWithCustomError(contractFactory, 'ERC1967InvalidImplementation')
|
||||
.withArgs(this.nonContractAddress);
|
||||
});
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ describe('BeaconProxy', function () {
|
||||
Object.assign(this, await loadFixture(fixture));
|
||||
});
|
||||
|
||||
describe('bad beacon is not accepted', async function () {
|
||||
describe('bad beacon is not accepted', function () {
|
||||
it('non-contract beacon', async function () {
|
||||
const notBeacon = this.other;
|
||||
|
||||
@ -34,7 +34,9 @@ describe('BeaconProxy', function () {
|
||||
it('non-compliant beacon', async function () {
|
||||
const badBeacon = await ethers.deployContract('BadBeaconNoImpl');
|
||||
|
||||
await expect(this.newBeaconProxy(badBeacon, '0x')).to.be.revertedWithoutReason;
|
||||
// BadBeaconNoImpl does not provide `implementation()` has no fallback.
|
||||
// This causes ERC1967Utils._setBeacon to revert.
|
||||
await expect(this.newBeaconProxy(badBeacon, '0x')).to.be.revertedWithoutReason();
|
||||
});
|
||||
|
||||
it('non-contract implementation', async function () {
|
||||
@ -92,7 +94,7 @@ describe('BeaconProxy', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('upgrade', async function () {
|
||||
describe('upgrade', function () {
|
||||
it('upgrade a proxy by upgrading its beacon', async function () {
|
||||
const value = 10n;
|
||||
const data = this.v1.interface.encodeFunctionData('initializeNonPayableWithValue', [value]);
|
||||
|
||||
@ -23,7 +23,7 @@ describe('UpgradeableBeacon', function () {
|
||||
.withArgs(this.other);
|
||||
});
|
||||
|
||||
describe('once deployed', async function () {
|
||||
describe('once deployed', function () {
|
||||
it('emits Upgraded event to the first implementation', async function () {
|
||||
await expect(this.beacon.deploymentTransaction()).to.emit(this.beacon, 'Upgraded').withArgs(this.v1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user