From: Chris Duncan Date: Fri, 6 Dec 2024 20:49:11 +0000 (-0800) Subject: Remove extraneous try-catch and rely on test function. Check account index is correct. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=9220b41f4bca80f82b970b8ab18849790703440a;p=libnemo.git Remove extraneous try-catch and rely on test function. Check account index is correct. --- diff --git a/test/derive-accounts.test.mjs b/test/derive-accounts.test.mjs index 1189d1a..7e2207d 100644 --- a/test/derive-accounts.test.mjs +++ b/test/derive-accounts.test.mjs @@ -35,20 +35,17 @@ test('should derive low indexed accounts from the given BIP-44 seed', async () = test('should derive high indexed accounts from the given seed', async () => { const wallet = await Bip44Wallet.fromSeed(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) - let accounts - try { - accounts = await wallet.accounts(0x70000000, 0x700000ff) - } catch (err) { - throw new Error(err.message) - } + const accounts = await wallet.accounts(0x70000000, 0x700000ff) assert.equals(accounts.length, 0x100) - for (const a of accounts) { + for (let i = 0; i < accounts.length; i++) { + const a = accounts[i] assert.exists(a) assert.exists(a.address) assert.exists(a.publicKey) assert.exists(a.privateKey) assert.exists(a.index) + assert.equals(a.index, i + 0x70000000) } })