Commit 071040f3 by Manuel Aráoz Committed by GitHub

Merge pull request #203 from ORBAT/fix/bounty-claim-fail-test

Await event handling result in Bounty test
parents 453a1982 cd78c20e
...@@ -52,7 +52,7 @@ contract('Bounty', function(accounts) { ...@@ -52,7 +52,7 @@ contract('Bounty', function(accounts) {
let bounty = await SecureTargetBounty.new(); let bounty = await SecureTargetBounty.new();
let event = bounty.TargetCreated({}); let event = bounty.TargetCreated({});
event.watch(async function(err, result) { let watcher = async function(err, result) {
event.stopWatching(); event.stopWatching();
if (err) { throw err; } if (err) { throw err; }
...@@ -66,8 +66,8 @@ contract('Bounty', function(accounts) { ...@@ -66,8 +66,8 @@ contract('Bounty', function(accounts) {
await bounty.claim(targetAddress, {from:researcher}); await bounty.claim(targetAddress, {from:researcher});
assert.isTrue(false); // should never reach here assert.isTrue(false); // should never reach here
} catch(error) { } catch(error) {
let reClaimedBounty = await bounty.claimed.call(); let reClaimedBounty = await bounty.claimed.call();
assert.isFalse(reClaimedBounty); assert.isFalse(reClaimedBounty);
} }
try { try {
...@@ -77,8 +77,9 @@ contract('Bounty', function(accounts) { ...@@ -77,8 +77,9 @@ contract('Bounty', function(accounts) {
assert.equal(reward, assert.equal(reward,
web3.eth.getBalance(bounty.address).toNumber()); web3.eth.getBalance(bounty.address).toNumber());
} }
}); };
bounty.createTarget({from:researcher}); bounty.createTarget({from:researcher});
await awaitEvent(event, watcher);
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment