diff options
author | Jacob Evans <jacob@dekz.net> | 2018-04-11 12:22:02 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2018-04-11 12:39:55 +0800 |
commit | 3ad693d33409dfd9d61beff3f43c4abaa369c6b1 (patch) | |
tree | 54eb616082ac245555a8072020b387a50eee42fa /packages/subproviders/test/unit | |
parent | 4aa67e292504fea307a4e5f15a124349fc769da6 (diff) | |
download | dexon-sol-tools-3ad693d33409dfd9d61beff3f43c4abaa369c6b1.tar dexon-sol-tools-3ad693d33409dfd9d61beff3f43c4abaa369c6b1.tar.gz dexon-sol-tools-3ad693d33409dfd9d61beff3f43c4abaa369c6b1.tar.bz2 dexon-sol-tools-3ad693d33409dfd9d61beff3f43c4abaa369c6b1.tar.lz dexon-sol-tools-3ad693d33409dfd9d61beff3f43c4abaa369c6b1.tar.xz dexon-sol-tools-3ad693d33409dfd9d61beff3f43c4abaa369c6b1.tar.zst dexon-sol-tools-3ad693d33409dfd9d61beff3f43c4abaa369c6b1.zip |
Test valid address format but not found
Diffstat (limited to 'packages/subproviders/test/unit')
-rw-r--r-- | packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts index 2bc84abc1..9131a8b6a 100644 --- a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts +++ b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts @@ -55,10 +55,16 @@ describe('MnemonicWalletSubprovider', () => { }); }); describe('failure cases', () => { - it('throws an error if account cannot be found', async () => { + it('throws an error if address is invalid ', async () => { const txData = { ...fixtureData.TX_DATA, from: '0x0' }; return expect(subprovider.signTransactionAsync(txData)).to.be.rejectedWith( - WalletSubproviderErrors.AddressNotFound, + WalletSubproviderErrors.FromAddressMissingOrInvalid, + ); + }); + it('throws an error if address is valid format but not found', async () => { + const txData = { ...fixtureData.TX_DATA, from: fixtureData.NULL_ADDRESS }; + return expect(subprovider.signTransactionAsync(txData)).to.be.rejectedWith( + `${WalletSubproviderErrors.AddressNotFound}: ${fixtureData.NULL_ADDRESS}`, ); }); }); @@ -155,12 +161,14 @@ describe('MnemonicWalletSubprovider', () => { const payload = { jsonrpc: '2.0', method: 'personal_sign', - params: [nonHexMessage, '0x0'], + params: [nonHexMessage, fixtureData.NULL_ADDRESS], 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`); + expect(err.message).to.be.equal( + `${WalletSubproviderErrors.AddressNotFound}: ${fixtureData.NULL_ADDRESS}`, + ); done(); }); provider.sendAsync(payload, callback); |