Skip to content

Instantly share code, notes, and snippets.

@iurimatias
Created June 20, 2018 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iurimatias/0b30a9c492c375ea57db2c35b80fff55 to your computer and use it in GitHub Desktop.
Save iurimatias/0b30a9c492c375ea57db2c35b80fff55 to your computer and use it in GitHub Desktop.
simple_storage_test.js
const SimpleStorage = embark.require('Embark/contracts/SimpleStorage');
let accounts;
config({
// note: accounts is optional
accounts: [
{ mnemonic: "a 12 word mnemonic", "balance": "5 ether"}
]
contracts: {
"SimpleStorage": {
args: [100],
onDeploy: ["SimpleStorage.methods.setRegistar(web3.eth.defaultAccount).send()"] // example
}
}
}, (err, theAccounts) => {
accounts = theAccounts;
});
contract("SimpleStorage", function () {
this.timeout(0);
it("should set constructor value", async function () {
let result = await SimpleStorage.methods.storedData().call();
assert.strictEqual(parseInt(result, 10), 100);
});
it("set storage value", async function () {
await SimpleStorage.methods.set(150).send();
let result = await SimpleStorage.methods.get().call();
assert.strictEqual(parseInt(result, 10), 499650);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment