Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Gustavo Antunes <[email protected]>
  • Loading branch information
dawnseeker8 and gantunesr authored Jul 10, 2024
1 parent c5bfddb commit 7bb9bb7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
15 changes: 5 additions & 10 deletions src/ledger-keyring.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,27 +230,22 @@ describe('LedgerKeyring', function () {
});
});

it('throws errors when address is not found', async function () {
it('throws an error when the address is not found', async function () {
const hdPath = `m/44'/60'/0'`;
const account = '0x90A5b70d94418d6c25C19071e5b8170607f6302D';

let thrownError;
const accountIndexes: Record<string, number> = {};
accountIndexes['0x90a'] = 1;

try {
await keyring.deserialize({
await expect(
keyring.deserialize({
hdPath,
accounts: [account],
deviceId: 'some-device',
implementFullBIP44: true,
accountIndexes,
});
} catch (error) {
thrownError = error;
}
expect(thrownError).toStrictEqual(new Error('Unknown address'));
});
}),
).rejects.toThrow('Unknown address');
});

describe('setDeviceId', function () {
Expand Down
2 changes: 1 addition & 1 deletion src/ledger-keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const pathBase = 'm';
const hdPathString = `${pathBase}/44'/60'/0'`;
const keyringType = 'Ledger Hardware';

// This number make one of our failure test very slow which for loop need to run 1000 times.
// This number causes one of our failing tests to run very slowly, as the for loop needs to iterate 1000 times.
const MAX_INDEX = 1000;

enum NetworkApiUrls {
Expand Down
2 changes: 1 addition & 1 deletion src/ledger-transport-middleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('LedgerTransportMiddleware', function () {
expect(app).toBeDefined();
});

it('throw error when transport not set', async function () {
it('throws an error when the transport object is not set', async function () {
transportMiddleware = new LedgerTransportMiddleware();
expect(() => transportMiddleware.getEthApp()).toThrow(
'Instance `transport` is not initialized.',
Expand Down

0 comments on commit 7bb9bb7

Please sign in to comment.