Created
June 20, 2018 15:03
-
-
Save iurimatias/0b30a9c492c375ea57db2c35b80fff55 to your computer and use it in GitHub Desktop.
simple_storage_test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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