Closed RomeDomeYome closed 2 years ago
Change the line const response = await FundMe.s_priceFeed
to const response = await FundMe.s_priceFeed()
And then do assert.equal(response, mockV3Aggregator.address)
@bot-eth-dev still throws this:
TypeError: Cannot read properties of undefined (reading 's_priceFeed')
I think I know what's up, After the first describe("FundMe",async() => {})
You didn't make use of beforeEach()
to initialize the contract and did it in the next describe("constructor", async function () {}
Because of this when you ran the next describe("constructor", async function () {}
you get TypeError: Cannot read properties of undefined (reading 's_priceFeed')
TLDR; Add a beforeEach() after the top most descibe() and initialize the contract in that section and NOT in the next describe()
@bot-eth-dev yes youre completely correct. it works now. thank you!!!
@bot-eth-dev i wouldve caught that had I just compared it to the original. Ill be sure to do that if I get stuck again
I follewed the instructions in the post below, but im still running into this issue.
"Hey @MasterofBlockchain Replace line 27 with
const response = await FundMe.getPriceFeed()
You are trying to call
s_priceFeed
which is markedprivate
in your contract hence it cannot be accessed outside the contract. Instead, use the getter functiongetPriceFeed()
that you created at the bottom of the contract to retrieves_priceFeed
"Originally posted by @othaime-en in https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions/2047#discussioncomment-3473459
Here is what my FundMe.sol looks like:
and my FundMe.test.js