I'm trying to trigger events in my solidity contract to output some debug information in my javascript tests. However the events seem to get never caught.
That's the relevant contract code:
pragma solidity ^0.4.4;
contract CrowdFunding {
uint public deadline;
event DeadlineSet(uint deadline, uint timeNow);
function withdrawal() returns(bool) {
DeadlineSet(deadline, now);
return true;
}
}
Here's how I try to listen for the events in my JavaScript test file:
var deadlineSet;
deadlineSet = contractInstance.DeadlineSet({_from:web3.eth.coinbase});
deadlineSet.watch(function(err, result) {
if(err) {
console.log(err);
return;
}
console.log("Deadline " + result.args.deadline);
console.log("Time Now " + result.args.timeNow);
deadlineSet.stopWatching();
});
My tests are working fine and I can send money to the contract and call methods, but I never see any of the console outputs defined above.
Any help is appreciated.