I'm getting the following error while trying to test whether addresses.
const { expect } = require('chai');
const { ethers } = require('hardhat');
const tokens = (n) => {
return ethers.utils.parseUnits(n.toString(), 'ether')
}
describe('Escrow', () => {
let buyer, seller, inspector, lender;
let realEstate, escrow;
beforeEach(async () =>{
[buyer, seller, inspector, lender] = await ethers.getSigners();
console.log(buyer.address)
console.log(seller.address)
console.log(inspector.address)
console.log(lender.address)
// Deploy the RealEstate
const RealEstate = await ethers.getContractFactory('RealEstate');
realEstate = await RealEstate.deploy();
// Mint
let transaction = await realEstate.connect(seller).mintFunc("https://ipfs.io/ipfs/QmTudSYeM7mz3PkYEWXWqPjomRPHogcMFSq7XAvsvsgAPS");
await transaction.wait();
// Deploy Escrow
const Escrow = await ethers.getContractFactory('Escrow')
escrow = await Escrow.deploy(
lender.address,
inspector.address,
seller.address,
realEstate.address,
)
})
describe('Deployments', () => {
it('Returns NFT address', async () => {
const result = await escrow.nftAddress()
expect(result).to.be.equal(realEstate.address)
})
it('Returns seller', async () => {
const result = await escrow.seller()
expect(result).to.be.equal(seller.address)
})
it('Returns inspector', async () => {
const result = await escrow.inspector()
expect(result).to.be.equal(inspector.address)
})
it('Returns lender', async () => {
const result = await escrow.lender()
expect(result).to.be.equal(lender.address)
})
})
})
While executing the tests using npx hardhat test command, I'm getting the following error:
Escrow
Deployments
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
0x70997970C51812dc3A010C7d01b50e0d17dc79C8
0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC
0x90F79bf6EB2c4f870365E785982E1f101E93b906
1) "before each" hook for "Returns seller"
0 passing (2s)
1 failing
1) Escrow
"before each" hook for "Returns seller":
TypeError: unsupported addressable value (argument="target", value=null, code=INVALID_ARGUMENT, version=6.13.1)
at makeError (node_modules\ethers\src.ts\utils\errors.ts:687:21)
at assert (node_modules\ethers\src.ts\utils\errors.ts:715:25)
at assertArgument (node_modules\ethers\src.ts\utils\errors.ts:727:5)
at resolveAddress (node_modules\ethers\src.ts\address\checks.ts:122:19)
at D:\Blockchain Projects\Zillow Clone\millow\node_modules\ethers\src.ts\contract\contract.ts:172:60
at ParamType.#walkAsync (node_modules\ethers\src.ts\abi\fragments.ts:779:24)
at ParamType.walkAsync (node_modules\ethers\src.ts\abi\fragments.ts:797:24)
at D:\Blockchain Projects\Zillow Clone\millow\node_modules\ethers\src.ts\contract\contract.ts:170:22
at Array.map (<anonymous>)
at resolveArgs (node_modules\ethers\src.ts\contract\contract.ts:169:37)