diff --git a/test/contract.js b/test/contract.js index 541621e5f8f..44370b02708 100644 --- a/test/contract.js +++ b/test/contract.js @@ -2816,26 +2816,26 @@ var runTests = function(contractFactory) { describe('typical usage', function() { runTests(getEthContractInstance); - it('should deploy a contract, sign transaction, and return contract instance', function (done) { + it('should deploy a contract, sign transaction, and return contract instance', void async function (done) { var provider = new FakeIpcProvider(); var eth = new Eth(provider); eth.accounts.wallet.add(account.privateKey); - provider.injectValidation(function (payload) { - - var expected = eth.accounts.wallet[0].signTransaction({ - data: '0x1234567000000000000000000000000' + account.address.toLowerCase().replace('0x', '') + '00000000000000000000000000000000000000000000000000000000000000c8', - from: account.address.toLowerCase(), - gas: '0xc350', - gasPrice: '0xbb8', - chainId: '0x1', - nonce: '0x1', - }).rawTransaction; - - assert.equal(payload.method, 'eth_sendRawTransaction'); - assert.deepEqual(payload.params, [expected]); + await ((async () => { + provider.injectValidation(async function (payload) { + var expected = (await eth.accounts.wallet[0].signTransaction({ + data: '0x1234567000000000000000000000000' + account.address.toLowerCase().replace('0x', '') + '00000000000000000000000000000000000000000000000000000000000000c8', + from: account.address.toLowerCase(), + gas: '0xc350', + gasPrice: '0xbb8', + chainId: '0x1', + nonce: '0x1', + })).rawTransaction; - }); + assert.equal(payload.method, 'eth_sendRawTransaction'); + assert.deepEqual(payload.params, [expected]); + }); + })()); provider.injectResult('0x5550000000000000000000000000000000000000000000000000000000000032'); provider.injectValidation(function (payload) { @@ -2844,7 +2844,6 @@ describe('typical usage', function() { }); provider.injectResult(null); - provider.injectValidation(function (payload) { assert.equal(payload.method, 'eth_subscribe'); assert.deepEqual(payload.params, ['newHeads']); diff --git a/test/eth.accounts.signTransaction.js b/test/eth.accounts.signTransaction.js index 1f99b317a0d..3788282fe03 100644 --- a/test/eth.accounts.signTransaction.js +++ b/test/eth.accounts.signTransaction.js @@ -51,20 +51,20 @@ describe("eth", function () { // For each test tests.forEach(function (test, i) { - it("signTransaction must compare to eth_signTransaction", function() { + it("signTransaction must compare to eth_signTransaction", async function() { var ethAccounts = new Accounts(); var testAccount = ethAccounts.privateKeyToAccount(test.privateKey); assert.equal(testAccount.address, test.address); - var tx = testAccount.signTransaction(test.transaction); + var tx = await testAccount.signTransaction(test.transaction); assert.equal(tx.rawTransaction, test.rawTransaction); }); }); tests.forEach(function (test, i) { - it("signTransaction using the iban as \"to\" must compare to eth_signTransaction", function() { + it("signTransaction using the iban as \"to\" must compare to eth_signTransaction", async function() { var ethAccounts = new Accounts(); var testAccount = ethAccounts.privateKeyToAccount(test.privateKey); @@ -73,7 +73,7 @@ describe("eth", function () { var transaction = clone(test.transaction); transaction.to = transaction.toIban; delete transaction.toIban; - var tx = testAccount.signTransaction(transaction); + var tx = await testAccount.signTransaction(transaction); assert.equal(tx.rawTransaction, test.rawTransaction); }); @@ -207,13 +207,13 @@ describe("eth", function () { }); tests.forEach(function (test, i) { - it("recoverTransaction, must recover signature", function() { + it("recoverTransaction, must recover signature", async function() { var ethAccounts = new Accounts(); var testAccount = ethAccounts.privateKeyToAccount(test.privateKey); assert.equal(testAccount.address, test.address); - var tx = testAccount.signTransaction(test.transaction); + var tx = await testAccount.signTransaction(test.transaction); assert.equal(ethAccounts.recoverTransaction(tx.rawTransaction), test.address); }); });