checking equality between mock and fundMe.getpriceFeed() #1325
-
describe("constructor", function () {
it("sets the aggregator addresses correctly", async () => {
const response = await fundMe.getPriceFeed()
assert.equal(response, mockV3Aggregator.address)
})
}) My question is that why we are checking equality between mock's address and fundMe.getPriceFeed() , i didnt get this concept so kindly .. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
@AwaisTahseencode Because the address that we passed to the contract constructor in the deploy script should be the same as the mock contract address. And we are only checking with mock-in unit tests because unit tests will run locally. |
Beta Was this translation helpful? Give feedback.
-
This is a unit test, a test which has almost complete coverage as it is ran locally. So, we check everything here. To be specific, in this case we are making sure if the price feed address in the main contract is the same as our mock address (as we are running locally -- because unit test is local -- we use a mock, so its address should match) Hope this helps |
Beta Was this translation helpful? Give feedback.
@AwaisTahseencode Because the address that we passed to the contract constructor in the deploy script should be the same as the mock contract address. And we are only checking with mock-in unit tests because unit tests will run locally.