Lesson 7: Error: Transaction reverted: function returned an unexpected amount of data #331
-
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 10 replies
-
You have to pass the deployer address in the Here's the full code for this test - it('update the amount funded data structure', async () => {
await fundMe.fund({ value: sendValue });
const response = await fundMe.getAddressToAmountFunded(deployer.address);
assert.equal(response.toString(), sendValue.toString());
}); Hope this will solve your issue. |
Beta Was this translation helpful? Give feedback.
-
console.log(sendValue) && console.log(response) console.log(typeof sendValue) && console.log(typeof response) lets see why they arent equal |
Beta Was this translation helpful? Give feedback.
-
@dibakarsutradhar I have identified the source of the error FundMe.sol (Line 47) | In the video it is commented out of the function ( // ) | When I comment it out, it passes 2 tests but fails at
====================================================================================== | When I leave it in passes 2 of the 3 test but fails at
======================================================================================= Still trying to figure out the reason for this. Any thoughts? @PatrickAlphaC Do you have any suggestions? |
Beta Was this translation helpful? Give feedback.
-
@dibakarsutradhar As I continued with the lesson I managed to fix the initial error as stated above but now I am getting the following error ====================================================================================== | Note that Any thoughts on what modification I could do to my fundMe contract to avoid previous error while fixing assertion error? |
Beta Was this translation helpful? Give feedback.
-
@dibakarsutradhar @mattjaf ==================================================================================== |
Beta Was this translation helpful? Give feedback.
@dibakarsutradhar @mattjaf
Fixed by removing await from
expect(fundMe.fund()).to.be.reverted;
====================================================================================