Swap target contract at test by using abstract interface

This commit is contained in:
Makoto Inoue
2016-10-22 18:16:42 +01:00
parent 9345436957
commit 986509934b
5 changed files with 35 additions and 9 deletions

View File

@ -1,8 +1,8 @@
contract('Bounty', function(accounts) {
it.only("create target", function(done){
it.only("can call checkInvarient for InsecureTargetMock", function(done){
var bounty = Bounty.deployed();
bounty.createTarget().
var target = SecureTargetMock.deployed();
bounty.createTarget(target.address).
then(function() {
return bounty.checkInvarient.call()
}).
@ -11,4 +11,17 @@ contract('Bounty', function(accounts) {
}).
then(done);
})
it("can call checkInvarient for InsecureTargetMock", function(done){
var bounty = Bounty.deployed();
var target = InsecureTargetMock.deployed();
bounty.createTarget(target.address).
then(function() {
return bounty.checkInvarient.call()
}).
then(function(result) {
assert.isFalse(result);
}).
then(done);
})
});