2018-06-07 16:14:42 -04:00
|
|
|
/*global contract, config, it, web3*/
|
2018-06-01 10:48:29 -04:00
|
|
|
const assert = require('assert');
|
2018-06-07 16:14:42 -04:00
|
|
|
const AnotherStorage = require('Embark/contracts/AnotherStorage');
|
|
|
|
const SimpleStorage = require('Embark/contracts/SimpleStorage');
|
2018-06-01 10:48:29 -04:00
|
|
|
|
2018-06-06 16:43:08 -04:00
|
|
|
let accounts;
|
|
|
|
|
2018-06-01 10:48:29 -04:00
|
|
|
config({
|
2018-06-06 15:33:48 -04:00
|
|
|
deployment: {
|
|
|
|
"accounts": [
|
|
|
|
{
|
2018-06-06 16:43:08 -04:00
|
|
|
"mnemonic": "example exile argue silk regular smile grass bomb merge arm assist farm",
|
|
|
|
balance: "5ether"
|
2018-06-06 15:33:48 -04:00
|
|
|
}
|
2018-07-31 11:01:52 +01:00
|
|
|
]
|
2018-06-06 15:33:48 -04:00
|
|
|
},
|
2018-06-01 10:48:29 -04:00
|
|
|
contracts: {
|
|
|
|
"SimpleStorage": {
|
|
|
|
args: [100]
|
|
|
|
},
|
|
|
|
"AnotherStorage": {
|
|
|
|
args: ["$SimpleStorage"]
|
|
|
|
}
|
|
|
|
}
|
2018-06-06 16:43:08 -04:00
|
|
|
}, (err, theAccounts) => {
|
|
|
|
accounts = theAccounts;
|
2018-06-01 10:48:29 -04:00
|
|
|
});
|
|
|
|
|
2017-07-03 18:15:43 -04:00
|
|
|
contract("AnotherStorage", function() {
|
2018-01-05 15:10:47 -05:00
|
|
|
this.timeout(0);
|
2017-02-09 19:38:02 -05:00
|
|
|
|
2018-06-08 13:10:47 -04:00
|
|
|
it("should have account with balance", async function() {
|
|
|
|
let balance = await web3.eth.getBalance(accounts[0]);
|
|
|
|
assert.ok(parseInt(balance, 10) > 4900000000000000000);
|
|
|
|
assert.ok(parseInt(balance, 10) <= 5000000000000000000);
|
|
|
|
});
|
|
|
|
|
2018-04-17 14:48:31 -04:00
|
|
|
it("set SimpleStorage address", async function() {
|
|
|
|
let result = await AnotherStorage.methods.simpleStorageAddress().call();
|
|
|
|
assert.equal(result.toString(), SimpleStorage.options.address);
|
2017-02-09 19:38:02 -05:00
|
|
|
});
|
2018-06-06 16:43:08 -04:00
|
|
|
|
2018-06-10 12:11:34 -04:00
|
|
|
it("set SimpleStorage address with alternative syntax", async function() {
|
|
|
|
let result = await AnotherStorage.simpleStorageAddress();
|
|
|
|
assert.equal(result.toString(), SimpleStorage.options.address);
|
|
|
|
});
|
2017-02-09 19:38:02 -05:00
|
|
|
});
|