]> zoso.dev Git - libnemo.git/commitdiff
Fix wrong assertion usage.
authorChris Duncan <chris@zoso.dev>
Fri, 6 Dec 2024 05:50:21 +0000 (21:50 -0800)
committerChris Duncan <chris@zoso.dev>
Fri, 6 Dec 2024 05:50:21 +0000 (21:50 -0800)
test/import-wallet.test.mjs

index 1c9f1e8bfee050a47a74e8331ee53e8eccdafd7c..eb2a56a974e942b239a11e6815b98ef704cc1db9 100644 (file)
@@ -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())\r
        assert.equals(accounts.length, 4)\r
        for (let i = 0; i < accounts.length; i++) {\r
-               assert.ok(accounts[i])\r
-               assert.ok(accounts[i].address)\r
-               assert.ok(accounts[i].publicKey)\r
-               assert.ok(accounts[i].privateKey)\r
+               assert.exists(accounts[i])\r
+               assert.exists(accounts[i].address)\r
+               assert.exists(accounts[i].publicKey)\r
+               assert.exists(accounts[i].privateKey)\r
                assert.equals(accounts[i].index, i)\r
        }\r
 })\r
@@ -119,18 +119,17 @@ test('import a BLAKE2b wallet with the zero seed', async () => {
        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
        const accounts = await wallet.accounts(0, 3)\r
 \r
-       console.log(`\nHERE 1\n`)\r
        assert.ok('mnemonic' in wallet)\r
        assert.ok('seed' in wallet)\r
        assert.equals(wallet.mnemonic, TREZOR_TEST_VECTORS.MNEMONIC_0)\r
        assert.equals(wallet.seed, TREZOR_TEST_VECTORS.ENTROPY_0)\r
        assert.equals(accounts.length, 4)\r
-       console.log(`\nHERE 2\n`)\r
+\r
        for (let i = 0; i < accounts.length; i++) {\r
-               assert.ok(accounts[i])\r
-               assert.ok(accounts[i].address)\r
-               assert.ok(accounts[i].publicKey)\r
-               assert.ok(accounts[i].privateKey)\r
+               assert.exists(accounts[i])\r
+               assert.exists(accounts[i].address)\r
+               assert.exists(accounts[i].publicKey)\r
+               assert.exists(accounts[i].privateKey)\r
                assert.equals(accounts[i].index, i)\r
        }\r
 })\r
@@ -162,13 +161,11 @@ test('get identical BLAKE2b wallets when created with a seed versus with its der
        const walletAccounts = await wallet.accounts()\r
        const walletAccount = walletAccounts[0]\r
 \r
-       console.log(`\nHERE 3\n`)\r
        assert.ok('mnemonic' in wallet)\r
        assert.ok('seed' in wallet)\r
-       assert.ok(walletAccount)\r
+       assert.exists(walletAccount)\r
        assert.equals(wallet.mnemonic, TREZOR_TEST_VECTORS.MNEMONIC_2)\r
 \r
-       console.log(`\nHERE 4\n`)\r
        const imported = await Blake2bWallet.fromMnemonic(TREZOR_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_2)\r
        await imported.unlock(TREZOR_TEST_VECTORS.PASSWORD)\r
        const importedAccounts = await imported.accounts()\r