Has anyone got Truffle tests to work with async/await?
My sample code for testing
require('babel-polyfill');
var ERCToken = artifacts.require("./ERCToken.sol");
var Proxy = artifacts.require("./Proxy.sol");
contract('ERCToken', function(accounts) {
it("should allow purchase", async function () {
var expected = 10;
var meta = ERCToken.deployed();
var result = await meta.purchase({from:accounts[0],value:80000});
var balance = await meta.balanceOf(accounts[0]);
assert.equal(balance.valueOf(),expected,"should have purchased "+ expected + "tokens");
});
});
TypeError: meta.purchase is not a function
The solidity program does have a function called purchase. ERCToken.deployed() doesn't seem to resolve without a then call.
Can anyone please tell me where am I going wrong?