Type error while testing the smartContract #252
-
This is the test script const { describe } = require("mocha")
const { ethers } = require("hardhat")
const { assert, expect } = require("chai")
describe("SimpleStorage", function () {
let simpleStorageFactory, simpleStorage
this.beforeEach(async function () {
const simpleStorageFactory = await ethers.getContractFactory(
"SimpleStorage"
)
const simpleStorage = await simpleStorageFactory.deploy()
await simpleStorage.deployed()
console.log(simpleStorage.address)
})
it("Should start with a favorite number of 0", async function () {
const currentValue = await simpleStorage.retrieve()
const expectedValue = "0"
assert.equal(currentValue.toString(), expectedValue)
})
}) now, while running the command
The output shows the error
|
Beta Was this translation helpful? Give feedback.
Answered by
javierdash
Jun 10, 2022
Replies: 2 comments 6 replies
-
Hi Gireeshbd!
await simpleStorage.deployed() |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
Gireeshbd
-
Thank you to the community for helping me out |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Gireeshbd!
Try doing this:
on “this.beforeEach” remove this.
Remove const on “const simpleStorageFactory” and from “const simpleStorage”
Remove this 2 lines:
await simpleStorage.deployed()
console.log(simpleStorage.address)