Lesson 6 - (14) Solidity Coverage #2184
-
Hey guys! At the end of the lesson 6 chapter, Patrick tells us to try writing the last test task for the addPerson function as practice. I'm getting this error when I run the test:
This is the test I wrote:
This is the addPerson function in the SimpleStorage contract:
Is there a specific way to access the mapping variable "nameToFavoriteNumber" using hardhat? Help would be appreciated. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
@musubbinomair : Your mapping code please! |
Beta Was this translation helpful? Give feedback.
-
Hey @AakashMalik274 Since addPerson is an array, you can either compare the values of the arrayat a particular index or you can compare each parameter in the array. In the test, you can do this:
|
Beta Was this translation helpful? Give feedback.
@musubbinomair : Your mapping code please!