I'm trying to run the folllowing test in truffle:
it("should accept a bet if there is enough in contract to cover it", async function(){ let instance = await CoinFlip.deployed(); await web3.eth.sendTransaction({from: accounts[0], to: "0x842F796082c5E6716B98C0d175F7C2EabE768e9b", value: web3.utils.toWei("15", "ether")}); await truffleAssert.passes(instance.bet(0, {from: accounts[1], value: web3.utils.toWei("2", "ether")}), truffleAssert.ErrorType.REVERT); });
When I do the truffle assert fails as follows:
1) Contract: CoinFlip should accept a bet if there is enough in contract to cover it: AssertionError: revert : Failed with Error: Returned error: VM Exception while processing transaction: revert Sorry, the contract cannot cover this bet. -- Reason given: Sorry, the contract cannot cover this bet.. at passes (node_modules\truffle-assertions\index.js:142:11) at processTicksAndRejections (internal/process/task_queues.js:97:5)
I then go into Ganache and attempt to click on the transaction that sent the 15 ether to the contract. When I click on this, Ganache gives the below error.
PLATFORM: win32
GANACHE VERSION: 2.5.4
EXCEPTION:
TypeError: Cannot read property 'stack' of undefined
at IpcMainImpl.<anonymous> (C:\Program Files\WindowsApps\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\app\resources\app.asar\webpack:\src\integrations\ethereum\index.js:96:31)