2018-08-21 19:25:18 +00:00
|
|
|
/*global contract, config, it, assert*/
|
|
|
|
const Branches = require('Embark/contracts/Branches');
|
|
|
|
|
|
|
|
config({
|
|
|
|
contracts: {
|
|
|
|
"Branches": {
|
|
|
|
args: [5]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
contract("Branches", function() {
|
|
|
|
it("should return the bigger value and set it", function(done) {
|
|
|
|
Branches.methods.bigger(10).send().then(() => {
|
|
|
|
Branches.methods.get().call().then((result) => {
|
|
|
|
assert.strictEqual(parseInt(result, 10), 10);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should return the set number if it's bigger", function(done) {
|
|
|
|
Branches.methods.bigger(1).send().then(() => {
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should return the smaller number", function(done) {
|
2018-08-21 20:23:00 +00:00
|
|
|
Branches.methods.smaller(10).send().then(() => { done(); });
|
2018-08-21 19:25:18 +00:00
|
|
|
});
|
2018-09-26 15:13:14 +00:00
|
|
|
|
|
|
|
it("should not crash code coverage on `if` without statements", function(done) {
|
|
|
|
Branches.methods.smallFunctionWithoutStatements().call().then(() => { done(); });
|
|
|
|
});
|
2018-08-21 19:25:18 +00:00
|
|
|
});
|