diff options
author | Jacob Evans <jacob@dekz.net> | 2018-04-10 09:58:12 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2018-04-10 09:58:12 +0800 |
commit | 5b69cd4a22ce1720f4441aaa74c86f895015c0fd (patch) | |
tree | 2a38d521a8b4a944d3e7c3634a56583b3960b354 /packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts | |
parent | 0e8f5004d6a53929a4cc1de9231c43899c8b6eeb (diff) | |
download | dexon-0x-contracts-5b69cd4a22ce1720f4441aaa74c86f895015c0fd.tar.gz dexon-0x-contracts-5b69cd4a22ce1720f4441aaa74c86f895015c0fd.tar.zst dexon-0x-contracts-5b69cd4a22ce1720f4441aaa74c86f895015c0fd.zip |
Added walletUtils and address in signMessage
Diffstat (limited to 'packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts')
-rw-r--r-- | packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts index e58461005..7aaef4944 100644 --- a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts +++ b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts @@ -9,7 +9,6 @@ import { DoneCallback, LedgerCommunicationClient, LedgerSubproviderErrors, - MnemonicSubproviderErrors, WalletSubproviderErrors, } from '../../src/types'; import { chaiSetup } from '../chai_setup'; @@ -48,7 +47,7 @@ describe('MnemonicWalletSubprovider', () => { it('throws an error if account cannot be found', async () => { const txData = { ...fixtureData.TX_DATA, from: '0x0' }; return expect(subprovider.signTransactionAsync(txData)).to.be.rejectedWith( - MnemonicSubproviderErrors.AddressSearchExhausted, + WalletSubproviderErrors.AddressNotFound, ); }); }); @@ -83,7 +82,7 @@ describe('MnemonicWalletSubprovider', () => { const payload = { jsonrpc: '2.0', method: 'eth_sign', - params: ['0x0000000000000000000000000000000000000000', messageHex], + params: [fixtureData.TEST_RPC_ACCOUNT_0, messageHex], id: 1, }; const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => { @@ -98,7 +97,7 @@ describe('MnemonicWalletSubprovider', () => { const payload = { jsonrpc: '2.0', method: 'personal_sign', - params: [messageHex, '0x0000000000000000000000000000000000000000'], + params: [messageHex, fixtureData.TEST_RPC_ACCOUNT_0], id: 1, }; const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => { @@ -115,7 +114,7 @@ describe('MnemonicWalletSubprovider', () => { const payload = { jsonrpc: '2.0', method: 'eth_sign', - params: ['0x0000000000000000000000000000000000000000', nonHexMessage], + params: [fixtureData.TEST_RPC_ACCOUNT_0, nonHexMessage], id: 1, }; const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => { @@ -130,7 +129,7 @@ describe('MnemonicWalletSubprovider', () => { const payload = { jsonrpc: '2.0', method: 'personal_sign', - params: [nonHexMessage, '0x0000000000000000000000000000000000000000'], + params: [nonHexMessage, fixtureData.TEST_RPC_ACCOUNT_0], id: 1, }; const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => { @@ -140,6 +139,21 @@ describe('MnemonicWalletSubprovider', () => { }); provider.sendAsync(payload, callback); }); + it('should throw if `address` param not found when calling personal_sign', (done: DoneCallback) => { + const nonHexMessage = 'hello world'; + const payload = { + jsonrpc: '2.0', + method: 'personal_sign', + params: [nonHexMessage, '0x0'], + id: 1, + }; + const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => { + expect(err).to.not.be.a('null'); + expect(err.message).to.be.equal(`${WalletSubproviderErrors.AddressNotFound}: 0x0`); + done(); + }); + provider.sendAsync(payload, callback); + }); it('should throw if `from` param missing when calling eth_sendTransaction', (done: DoneCallback) => { const tx = { to: '0xafa3f8684e54059998bc3a7b0d2b0da075154d66', |