aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders/test
diff options
context:
space:
mode:
authorJacob Evans <jacob@dekz.net>2018-04-10 12:39:43 +0800
committerJacob Evans <jacob@dekz.net>2018-04-10 12:39:43 +0800
commit84a4b7d1c16d008ffbf07ba5b22c61b025b5165f (patch)
tree54b6156824c31df39159f78cd306f0b8d2e26dc4 /packages/subproviders/test
parent5b69cd4a22ce1720f4441aaa74c86f895015c0fd (diff)
downloaddexon-sol-tools-84a4b7d1c16d008ffbf07ba5b22c61b025b5165f.tar
dexon-sol-tools-84a4b7d1c16d008ffbf07ba5b22c61b025b5165f.tar.gz
dexon-sol-tools-84a4b7d1c16d008ffbf07ba5b22c61b025b5165f.tar.bz2
dexon-sol-tools-84a4b7d1c16d008ffbf07ba5b22c61b025b5165f.tar.lz
dexon-sol-tools-84a4b7d1c16d008ffbf07ba5b22c61b025b5165f.tar.xz
dexon-sol-tools-84a4b7d1c16d008ffbf07ba5b22c61b025b5165f.tar.zst
dexon-sol-tools-84a4b7d1c16d008ffbf07ba5b22c61b025b5165f.zip
Refactor ledger to support multiple accounts with from address
Diffstat (limited to 'packages/subproviders/test')
-rw-r--r--packages/subproviders/test/integration/ledger_subprovider_test.ts3
-rw-r--r--packages/subproviders/test/unit/ledger_subprovider_test.ts8
-rw-r--r--packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts5
-rw-r--r--packages/subproviders/test/utils/fixture_data.ts2
4 files changed, 12 insertions, 6 deletions
diff --git a/packages/subproviders/test/integration/ledger_subprovider_test.ts b/packages/subproviders/test/integration/ledger_subprovider_test.ts
index 503618089..88a3c6db1 100644
--- a/packages/subproviders/test/integration/ledger_subprovider_test.ts
+++ b/packages/subproviders/test/integration/ledger_subprovider_test.ts
@@ -42,9 +42,10 @@ describe('LedgerSubprovider', () => {
expect(accounts[0]).to.not.be.an('undefined');
expect(accounts.length).to.be.equal(10);
});
- it('returns the expected first account from a ledger set up with the test mnemonic', async () => {
+ it('returns the expected accounts from a ledger set up with the test mnemonic', async () => {
const accounts = await ledgerSubprovider.getAccountsAsync();
expect(accounts[0]).to.be.equal(fixtureData.TEST_RPC_ACCOUNT_0);
+ expect(accounts[1]).to.be.equal(fixtureData.TEST_RPC_ACCOUNT_1);
});
it('returns requested number of accounts', async () => {
const numberOfAccounts = 20;
diff --git a/packages/subproviders/test/unit/ledger_subprovider_test.ts b/packages/subproviders/test/unit/ledger_subprovider_test.ts
index c18506681..d3a3fbe26 100644
--- a/packages/subproviders/test/unit/ledger_subprovider_test.ts
+++ b/packages/subproviders/test/unit/ledger_subprovider_test.ts
@@ -132,7 +132,7 @@ describe('LedgerSubprovider', () => {
const payload = {
jsonrpc: '2.0',
method: 'eth_sign',
- params: ['0x0000000000000000000000000000000000000000', messageHex],
+ params: [FAKE_ADDRESS, messageHex],
id: 1,
};
const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => {
@@ -149,7 +149,7 @@ describe('LedgerSubprovider', () => {
const payload = {
jsonrpc: '2.0',
method: 'personal_sign',
- params: [messageHex, '0x0000000000000000000000000000000000000000'],
+ params: [messageHex, FAKE_ADDRESS],
id: 1,
};
const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => {
@@ -190,7 +190,7 @@ describe('LedgerSubprovider', () => {
const payload = {
jsonrpc: '2.0',
method: 'eth_sign',
- params: ['0x0000000000000000000000000000000000000000', nonHexMessage],
+ params: [FAKE_ADDRESS, nonHexMessage],
id: 1,
};
const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => {
@@ -205,7 +205,7 @@ describe('LedgerSubprovider', () => {
const payload = {
jsonrpc: '2.0',
method: 'personal_sign',
- params: [nonHexMessage, '0x0000000000000000000000000000000000000000'],
+ params: [nonHexMessage, FAKE_ADDRESS],
id: 1,
};
const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => {
diff --git a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts
index 7aaef4944..16981cf86 100644
--- a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts
+++ b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts
@@ -28,9 +28,12 @@ describe('MnemonicWalletSubprovider', () => {
});
describe('direct method calls', () => {
describe('success cases', () => {
- it('returns the account', async () => {
+ it('returns the accounts', async () => {
const accounts = await subprovider.getAccountsAsync();
+ // tslint:disable-next-line:no-console
+ console.log(accounts);
expect(accounts[0]).to.be.equal(fixtureData.TEST_RPC_ACCOUNT_0);
+ expect(accounts[1]).to.be.equal(fixtureData.TEST_RPC_ACCOUNT_1);
expect(accounts.length).to.be.equal(10);
});
it('signs a personal message', async () => {
diff --git a/packages/subproviders/test/utils/fixture_data.ts b/packages/subproviders/test/utils/fixture_data.ts
index 5ce3ff08f..62b76e132 100644
--- a/packages/subproviders/test/utils/fixture_data.ts
+++ b/packages/subproviders/test/utils/fixture_data.ts
@@ -1,8 +1,10 @@
const TEST_RPC_ACCOUNT_0 = '0x5409ed021d9299bf6814279a6a1411a7e866a631';
+const TEST_RPC_ACCOUNT_1 = '0x6ecbe1db9ef729cbe972c83fb886247691fb6beb';
const networkId = 42;
export const fixtureData = {
TEST_RPC_ACCOUNT_0,
TEST_RPC_ACCOUNT_0_ACCOUNT_PRIVATE_KEY: 'F2F48EE19680706196E2E339E5DA3491186E0C4C5030670656B0E0164837257D',
+ TEST_RPC_ACCOUNT_1,
TEST_RPC_MNEMONIC: 'concert load couple harbor equip island argue ramp clarify fence smart topic',
TEST_RPC_MNEMONIC_DERIVATION_PATH: `44'/60'/0'/0`,
PERSONAL_MESSAGE_STRING: 'hello world',