From 332d1b6c2dcde11cfa873a53dd95350b784e6aa1 Mon Sep 17 00:00:00 2001 From: kf Date: Sun, 17 Apr 2022 11:33:21 +0000 Subject: [PATCH] maint(ct): clean up OVM_ETH tests Cleans up OVM_ETH tests using the same techniques as other cleanup PRs. --- .../contracts/L2/predeploys/OVM_ETH.spec.ts | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/packages/contracts/test/contracts/L2/predeploys/OVM_ETH.spec.ts b/packages/contracts/test/contracts/L2/predeploys/OVM_ETH.spec.ts index f2391e6a34721..df05c8b6acc8b 100644 --- a/packages/contracts/test/contracts/L2/predeploys/OVM_ETH.spec.ts +++ b/packages/contracts/test/contracts/L2/predeploys/OVM_ETH.spec.ts @@ -1,31 +1,26 @@ /* External Imports */ import { ethers } from 'hardhat' -import { ContractFactory, Contract, Signer } from 'ethers' +import { Contract } from 'ethers' +import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers' import { expect } from '../../../setup' +import { deploy } from '../../../helpers' describe('OVM_ETH', () => { - let signer1: Signer - let signer2: Signer + let signer1: SignerWithAddress + let signer2: SignerWithAddress before(async () => { ;[signer1, signer2] = await ethers.getSigners() }) - let Factory__OVM_ETH: ContractFactory - before(async () => { - Factory__OVM_ETH = await ethers.getContractFactory('OVM_ETH') - }) - let OVM_ETH: Contract beforeEach(async () => { - OVM_ETH = await Factory__OVM_ETH.deploy() + OVM_ETH = await deploy('OVM_ETH') }) describe('transfer', () => { it('should revert', async () => { - await expect( - OVM_ETH.transfer(await signer2.getAddress(), 100) - ).to.be.revertedWith( + await expect(OVM_ETH.transfer(signer2.address, 100)).to.be.revertedWith( 'OVM_ETH: transfer is disabled pending further community discussion.' ) }) @@ -33,9 +28,7 @@ describe('OVM_ETH', () => { describe('approve', () => { it('should revert', async () => { - await expect( - OVM_ETH.approve(await signer2.getAddress(), 100) - ).to.be.revertedWith( + await expect(OVM_ETH.approve(signer2.address, 100)).to.be.revertedWith( 'OVM_ETH: approve is disabled pending further community discussion.' ) }) @@ -44,11 +37,7 @@ describe('OVM_ETH', () => { describe('transferFrom', () => { it('should revert', async () => { await expect( - OVM_ETH.transferFrom( - await signer1.getAddress(), - await signer2.getAddress(), - 100 - ) + OVM_ETH.transferFrom(signer1.address, signer2.address, 100) ).to.be.revertedWith( 'OVM_ETH: transferFrom is disabled pending further community discussion.' ) @@ -58,7 +47,7 @@ describe('OVM_ETH', () => { describe('increaseAllowance', () => { it('should revert', async () => { await expect( - OVM_ETH.increaseAllowance(await signer2.getAddress(), 100) + OVM_ETH.increaseAllowance(signer2.address, 100) ).to.be.revertedWith( 'OVM_ETH: increaseAllowance is disabled pending further community discussion.' ) @@ -68,7 +57,7 @@ describe('OVM_ETH', () => { describe('decreaseAllowance', () => { it('should revert', async () => { await expect( - OVM_ETH.decreaseAllowance(await signer2.getAddress(), 100) + OVM_ETH.decreaseAllowance(signer2.address, 100) ).to.be.revertedWith( 'OVM_ETH: decreaseAllowance is disabled pending further community discussion.' )