PatrickAlphaC / hardhat-smartcontract-lottery-fcc

MIT License
117 stars 183 forks source link

How to mock .call function in unit tests #210

Open mwojtal19 opened 2 months ago

mwojtal19 commented 2 months ago

In fulfillRandomWords function there is a code:

        (bool success, ) = recentWinner.call{value: address(this).balance}("");
        if (!success) {
            revert Raffle__TransferFailed();
        }

Is there a way to mock the .call function to return false and test this if statement?