Lesson 14: BasicNft Unit test #2121
-
Hi all, Just saw the below Unit test-script snippet at this course's repo and saw Usually, we have been taught to input But, this still works. So, does it mean that beforeEach(async () => {
accounts = await ethers.getSigners()
deployer = accounts[0]
await deployments.fixture(["basicnft"])
basicNft = await ethers.getContract("BasicNft")
}) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@ManuWeb3 : Yes both instances will work just fine, If you are only using the deployer, Sometimes you have more than one Users so you have to deploy with by connecting them to the contract. |
Beta Was this translation helpful? Give feedback.
@ManuWeb3 : Yes both instances will work just fine, If you are only using the deployer,
but the good practice what I do is to connect the deployer or whatever user is when getting contract.
Sometimes you have more than one Users so you have to deploy with by connecting them to the contract.
This usually we have to do when we are testing our contract.
For Example:
basicNft = await ethers.getContract("BasicNft", deployer)
basicNft = await ethers.getContract("BasicNft", user)