Tests for signed transactions and multiple accounts

This commit is contained in:
Jacob Evans
2018-04-11 12:56:52 +10:00
parent eee190826a
commit 65b2c936ab
3 changed files with 12 additions and 0 deletions

View File

@@ -73,6 +73,11 @@ describe('LedgerSubprovider', () => {
const txHex = await ledgerSubprovider.signTransactionAsync(fixtureData.TX_DATA);
expect(txHex).to.be.equal(fixtureData.TX_DATA_SIGNED_RESULT);
});
it('signs a transaction with the second address', async () => {
const txData = { ...fixtureData.TX_DATA, from: fixtureData.TEST_RPC_ACCOUNT_1 };
const txHex = await ledgerSubprovider.signTransactionAsync(txData);
expect(txHex).to.be.equal(fixtureData.TX_DATA_ACCOUNT_1_SIGNED_RESULT);
});
});
describe('calls through a provider', () => {
let defaultProvider: Web3ProviderEngine;

View File

@@ -48,6 +48,11 @@ describe('MnemonicWalletSubprovider', () => {
const txHex = await subprovider.signTransactionAsync(fixtureData.TX_DATA);
expect(txHex).to.be.equal(fixtureData.TX_DATA_SIGNED_RESULT);
});
it('signs a transaction with the second address', async () => {
const txData = { ...fixtureData.TX_DATA, from: fixtureData.TEST_RPC_ACCOUNT_1 };
const txHex = await subprovider.signTransactionAsync(txData);
expect(txHex).to.be.equal(fixtureData.TX_DATA_ACCOUNT_1_SIGNED_RESULT);
});
});
describe('failure cases', () => {
it('throws an error if account cannot be found', async () => {

View File

@@ -26,4 +26,6 @@ export const fixtureData = {
// This is the signed result of the abouve Transaction Data
TX_DATA_SIGNED_RESULT:
'0xf85f8080822710940000000000000000000000000000000000000000808078a0712854c73c69445cc1b22a7c3d7312ff9a97fe4ffba35fd636e8236b211b6e7ca0647cee031615e52d916c7c707025bc64ad525d8f1b9876c3435a863b42743178',
TX_DATA_ACCOUNT_1_SIGNED_RESULT:
'0xf85f8080822710940000000000000000000000000000000000000000808078a04b02af7ff3f18ce114b601542cc8ebdc50921354f75dd510d31793453a0710e6a0540082a01e475465801b8186a2edc79ec1a2dcf169b9781c25a58a417023c9ca',
};