Lesson 7- Explain Unit test for constructor #2725
-
I'm having a hard time understanding how the assert part passes the test in the following code
Question: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Hey @VeerniVishwanath you are right, |
Beta Was this translation helpful? Give feedback.
-
Yes, you are right, assert.equal checks if the given values are equal are not. For your concerns. MockV3Aggregator is the mock contract you deployed, so MockV3Aggregator.address will return its deployed address. This test is to ensure the main contract is using the right MockV3Aggregator contract by identify its contract address. |
Beta Was this translation helpful? Give feedback.
-
While we're on this topic, I have a doubt that I want someone to clear for me: Since Someone please clear it for me. I feel like ripping my head off. |
Beta Was this translation helpful? Give feedback.
Hey @VeerniVishwanath you are right,
response
returns an address whilemockV3Aggregator
is an object. However,mockV3Aggregator.address
which is used in the assert is not an object, it is also an address.In your code above, I'm seeing you are logging both
response
andmockV3Aggregator
to the terminal. To test my theory, try logging outmockV3Aggregator.address
instead of justmockV3Aggregator
and you'll finally see that the two are equal.Use
console.log(mockV3Aggregator.address);