Testing in hardhat and solidity arrays #634
AmadiMichael
started this conversation in
General
Replies: 2 comments 1 reply
-
Hey! I was looking for a solution to test my entire code too and I was struggling with how to test the array and the mapping. I've found the answer on another discussion, check it out : #483 Hopefully I'm not too late! |
Beta Was this translation helpful? Give feedback.
1 reply
-
Oh wow nice, thanks for this !
This will help
…On Sun, Jul 31, 2022, 2:01 AM BLR19 ***@***.***> wrote:
Hey!
I was looking for a solution to test my entire code too and I was
struggling with how to test the array and the mapping.
I've found the answer on another discussion, check it out : #483
<#483>
Hopefully I'm not too late!
—
Reply to this email directly, view it on GitHub
<#634 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXHT2IAVRS6P4AZN7P5MLOLVWXF7LANCNFSM52DSH6IA>
.
You are receiving this because you authored the thread.Message ID:
<smartcontractkit/full-blockchain-solidity-course-js/repo-discussions/634/comments/3288866
@github.com>
|
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello guys
In lesson 6
Patrick mentioned that we can go ahead for write tests for the lines that he didn't so I decided to take up the challenge..
To do this test I decided to write a function in the SimpleStorage.sol that creates a memory array of People structs and length set to people.length.
Then it loops through the already existing people array and sets each array member's index to be equal to the corresponding index on the new array I created in memory. Then I return it.
It works fine as it should in solidity but in the tests when I write it. It has some errors
Here is my test file
But when i run
It gives this error in my terminal
Anyone experiencing this or done this successfully yet?
Or is there a way to read the value of the array directly like functions without having to create a function in solidity
Beta Was this translation helpful? Give feedback.
All reactions