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:
Franco Victorio
2024-03-14 17:35:08 +01:00
committed by GitHub
parent 33ea1111b0
commit c03952acbe
13 changed files with 64 additions and 59 deletions

View File

@ -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);
});

View File

@ -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]);

View File

@ -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);
});