it('can get gas estimate for transaction', async function() { const c = new FlexContract(ABI, {provider: provider, bytecode: BYTECODE}); await c.new(123).send(); const r = await c.transact().gas(); assert.ok(_.isNumber(r) && r > 0); });
describe("thenReturn", function () { it("forwards errors", () => { return Promise.reject(10) .thenReturn(100) .then(assert.fail, assert.ok); }); });
describe("Simple Tests", function () { describe("Constructor Test", function () { it("Object is created", function () { assert.ok(true); }); it("Has some text", function () { assert.equal("Hello there",famousPeople.someText); }); }); describe("Famous Names", function () { it("Has three", function () { assert.equal(3, famousPeople.famousNames().length); }); }); });
it('can encode call data', async function() { const c = new FlexContract(ABI, {provider: provider, bytecode: BYTECODE}); const r = await c.constFn(2).encode(); assert.ok(r && r !== '0x'); });
it('can wait for confirmation', async function() { const c = new FlexContract(ABI, {provider: provider, bytecode: BYTECODE}); await c.new(123).send(); const r = c.transact().send(); await r; const confirmed = (async () => { return r.confirmed(4); })(); // Force ganache to mine some new blocks and send confirmations. for (let i = 0; i < 4; i++) await c.transact().send(); assert.ok(await confirmed); });
it('can get gas estimate for deployment', async function() { const c = new FlexContract(ABI, {provider: provider, bytecode: BYTECODE}); const r = await c.new(123).gas(); assert.ok(_.isNumber(r) && r > 0); });
it('can wait for confirmation after it already happened', async function() { const c = new FlexContract(ABI, {provider: provider, bytecode: BYTECODE}); await c.new(123).send(); const r = c.transact().send(); await r; // Force ganache to mine some new blocks and send confirmations. for (let i = 0; i < 4; i++) await c.transact().send(); assert.ok(await r.confirmed(4)); });