Skip to content

Commit

Permalink
test/foreign: increase coverage: add test "should not be possible to …
Browse files Browse the repository at this point in the history
…do same deposit twice for same authority"
  • Loading branch information
snd committed Jan 11, 2018
1 parent 3a48367 commit ddc2e02
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions truffle/test/foreign.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,25 @@ contract('ForeignBridge', function(accounts) {
})
})

it("should not be possible to do same deposit twice for same authority", function() {
var meta;
var requiredSignatures = 1;
var authorities = [accounts[0], accounts[1]];
var userAccount = accounts[2];
var value = web3.toWei(1, "ether");
var hash = "0xe55bb43c36cdf79e23b4adc149cdded921f0d482e613c50c6540977c213bc408";

return ForeignBridge.new(requiredSignatures, authorities).then(function(instance) {
meta = instance;
return meta.deposit(userAccount, value, hash, { from: authorities[0] });
}).then(function(_) {
return meta.deposit(userAccount, value, hash, { from: authorities[0] });
}).then(function(result) {
assert(false, "doing same deposit twice from same authority should fail");
}, function(err) {
})
})

it("should ignore misbehaving authority when confirming deposit", function() {
var meta;
var requiredSignatures = 2;
Expand Down

0 comments on commit ddc2e02

Please sign in to comment.