add test for deployIf

This commit is contained in:
Iuri Matias 2018-08-24 09:12:31 -04:00
parent c52142cb4c
commit 5fa089d51c
2 changed files with 7 additions and 1 deletions

View File

@ -64,6 +64,6 @@ contract Token {
return (a + b >= a);
}
function isAvailable() public constant returns (bool) {
return true;
return false;
}
}

View File

@ -5,6 +5,7 @@ const MyToken = require('Embark/contracts/MyToken');
const MyToken2 = require('Embark/contracts/MyToken2');
const AlreadyDeployedToken = require('Embark/contracts/AlreadyDeployedToken');
const Test = require('Embark/contracts/Test');
const SomeContract = require('Embark/contracts/SomeContract');
config({
contracts: {
@ -40,6 +41,7 @@ config({
}
},
SomeContract: {
deployIf: "MyToken.methods.isAvailable().call()",
args: [
["$MyToken2", "$SimpleStorage"],
100
@ -79,4 +81,8 @@ describe("Token", function () {
let result = await Test.methods.addr().call();
assert.strictEqual(result, MyToken.options.address);
});
it("should not deploy if deployIf returns false", async function() {
assert.ok(!SomeContract.options.address);
});
});