Skip to content

Instantly share code, notes, and snippets.

@sogoiii
Created June 30, 2017 18:53
Show Gist options
  • Save sogoiii/f9664a547fd7baf800c1805f8b460a37 to your computer and use it in GitHub Desktop.
Save sogoiii/f9664a547fd7baf800c1805f8b460a37 to your computer and use it in GitHub Desktop.
Comparing simple truffle test as promise chain or async/await
const status = () => {
return MetaCoin.deployed()
.then(instance => {
return instance.getBalance.call(accounts[0]);
})
.then(balance => {
assert.equal(balance.valueOf(), 10000, "10000 wasn't in the first account");
})
}
const status2 = function async () {
let meta = await MetaCoin.deployed();
let balance = await meta.getBalance.call(accounts[0]);
assert.equal(balance.valueOf(), 10000, "10000 wasn't in the first account")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment