From 2bc0898f6843b09b6f9d04cb7eba855755b8db25 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Thu, 5 Dec 2024 21:50:21 -0800 Subject: [PATCH] Fix wrong assertion usage. --- test/import-wallet.test.mjs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/test/import-wallet.test.mjs b/test/import-wallet.test.mjs index 1c9f1e8..eb2a56a 100644 --- a/test/import-wallet.test.mjs +++ b/test/import-wallet.test.mjs @@ -106,10 +106,10 @@ test('import a BIP-44 wallet with the zero seed', async () => { assert.equals(wallet.seed, TREZOR_TEST_VECTORS.SEED_0.toUpperCase()) assert.equals(accounts.length, 4) for (let i = 0; i < accounts.length; i++) { - assert.ok(accounts[i]) - assert.ok(accounts[i].address) - assert.ok(accounts[i].publicKey) - assert.ok(accounts[i].privateKey) + assert.exists(accounts[i]) + assert.exists(accounts[i].address) + assert.exists(accounts[i].publicKey) + assert.exists(accounts[i].privateKey) assert.equals(accounts[i].index, i) } }) @@ -119,18 +119,17 @@ test('import a BLAKE2b wallet with the zero seed', async () => { await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) const accounts = await wallet.accounts(0, 3) - console.log(`\nHERE 1\n`) assert.ok('mnemonic' in wallet) assert.ok('seed' in wallet) assert.equals(wallet.mnemonic, TREZOR_TEST_VECTORS.MNEMONIC_0) assert.equals(wallet.seed, TREZOR_TEST_VECTORS.ENTROPY_0) assert.equals(accounts.length, 4) - console.log(`\nHERE 2\n`) + for (let i = 0; i < accounts.length; i++) { - assert.ok(accounts[i]) - assert.ok(accounts[i].address) - assert.ok(accounts[i].publicKey) - assert.ok(accounts[i].privateKey) + assert.exists(accounts[i]) + assert.exists(accounts[i].address) + assert.exists(accounts[i].publicKey) + assert.exists(accounts[i].privateKey) assert.equals(accounts[i].index, i) } }) @@ -162,13 +161,11 @@ test('get identical BLAKE2b wallets when created with a seed versus with its der const walletAccounts = await wallet.accounts() const walletAccount = walletAccounts[0] - console.log(`\nHERE 3\n`) assert.ok('mnemonic' in wallet) assert.ok('seed' in wallet) - assert.ok(walletAccount) + assert.exists(walletAccount) assert.equals(wallet.mnemonic, TREZOR_TEST_VECTORS.MNEMONIC_2) - console.log(`\nHERE 4\n`) const imported = await Blake2bWallet.fromMnemonic(TREZOR_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_2) await imported.unlock(TREZOR_TEST_VECTORS.PASSWORD) const importedAccounts = await imported.accounts() -- 2.34.1