]> zoso.dev Git - libnemo.git/commitdiff
Remove extraneous try-catch and rely on test function. Check account index is correct.
authorChris Duncan <chris@zoso.dev>
Fri, 6 Dec 2024 20:49:11 +0000 (12:49 -0800)
committerChris Duncan <chris@zoso.dev>
Fri, 6 Dec 2024 20:49:11 +0000 (12:49 -0800)
test/derive-accounts.test.mjs

index 1189d1a27d644b28899e96b13d6d8b434b2ee460..7e2207d8f3d6d59f7ff1f4b02bc1f860215f6349 100644 (file)
@@ -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 () => {\r
        const wallet = await Bip44Wallet.fromSeed(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
-       let accounts\r
-       try {\r
-               accounts = await wallet.accounts(0x70000000, 0x700000ff)\r
-       } catch (err) {\r
-               throw new Error(err.message)\r
-       }\r
+       const accounts = await wallet.accounts(0x70000000, 0x700000ff)\r
 \r
        assert.equals(accounts.length, 0x100)\r
-       for (const a of accounts) {\r
+       for (let i = 0; i < accounts.length; i++) {\r
+               const a = accounts[i]\r
                assert.exists(a)\r
                assert.exists(a.address)\r
                assert.exists(a.publicKey)\r
                assert.exists(a.privateKey)\r
                assert.exists(a.index)\r
+               assert.equals(a.index, i + 0x70000000)\r
        }\r
 })\r
 \r