ReferenceError: blockToken is not defined #5203
Answered
by
alymurtazamemon
kihiuFrank
asked this question in
Q&A
-
Hello guys. test.jsconst { assert, expect } = require("chai")
const { network, ethers, deployments } = require("hardhat")
const { developmentChains } = require("../helper-hardhat-config")
!developmentChains.includes(network.name)
? describe.skip
: describe("Unit tests for Block Token", () => {
beforeEach("runs before each test", async () => {
let accounts, deployer, blockToken
accounts = await ethers.getSigners()
accounts[0] = deployer
await deployments.fixture(["blockToken"])
blockToken = await ethers.getContract("BlockToken")
})
it("deploys succefully", async () => {
assert(blockToken.address) // error on this line
})
}) BlockToken.sol// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract BlockToken is ERC20 {
constructor(uint256 initialSupply) ERC20("Block", "BLK") {
_mint(msg.sender, initialSupply);
}
}
Even when I hover my cursor on |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Apr 1, 2023
Replies: 1 comment 1 reply
-
@kihiuFrank This blockToken variable is not defined; beforeEach("runs before each test", async () => {
let accounts, deployer, blockToken
accounts = await ethers.getSigners()
accounts[0] = deployer
await deployments.fixture(["blockToken"])
blockToken = await ethers.getContract("BlockToken")
}) update this to this; let blockToken;
beforeEach("runs before each test", async () => {
let accounts, deployer, blockToken
accounts = await ethers.getSigners()
accounts[0] = deployer
await deployments.fixture(["blockToken"])
blockToken = await ethers.getContract("BlockToken")
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
kihiuFrank
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@kihiuFrank This blockToken variable is not defined;
update this to this;