embark/test_apps/test_app/test/another_storage_spec.js

43 lines
1.1 KiB
JavaScript
Raw Normal View History

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