add test for deployIf
This commit is contained in:
parent
c52142cb4c
commit
5fa089d51c
|
@ -64,6 +64,6 @@ contract Token {
|
|||
return (a + b >= a);
|
||||
}
|
||||
function isAvailable() public constant returns (bool) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue