From 323796171c45be39b8af86cac98f199c39f03395 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Thu, 3 Jul 2025 14:14:27 -0700 Subject: [PATCH] Fix test descriptions. Add tsc ignore directives for lock and unlock parameter type testing. --- test/test.lock-unlock-wallet.mjs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/test.lock-unlock-wallet.mjs b/test/test.lock-unlock-wallet.mjs index 71b372c..2252f04 100644 --- a/test/test.lock-unlock-wallet.mjs +++ b/test/test.lock-unlock-wallet.mjs @@ -28,7 +28,7 @@ await suite('Lock and unlock wallets', async () => { await wallet.destroy() }) - await test('locking and unlocking a Bip44Wallet with a random CryptoKey', async () => { + await test('locking and unlocking a Bip44Wallet with random bytes', async () => { const wallet = await Bip44Wallet.fromMnemonic(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) const key = await globalThis.crypto.subtle.generateKey({ name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt']) @@ -66,7 +66,7 @@ await suite('Lock and unlock wallets', async () => { await wallet.destroy() }) - await test('fail to unlock a Bip44Wallet with different keys', async () => { + await test('fail to unlock a Bip44Wallet with different random bytes', async () => { const wallet = await Bip44Wallet.fromMnemonic(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) const rightKey = await globalThis.crypto.subtle.generateKey({ name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt']) @@ -100,6 +100,7 @@ await suite('Lock and unlock wallets', async () => { const wallet = await Bip44Wallet.fromMnemonic(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) + //@ts-expect-error await assert.rejects(wallet.lock(), { message: 'Failed to lock wallet' }) assert.ok('mnemonic' in wallet) assert.ok('seed' in wallet) @@ -108,6 +109,7 @@ await suite('Lock and unlock wallets', async () => { await wallet.lock('password') + //@ts-expect-error await assert.rejects(wallet.unlock(), { message: 'Failed to unlock wallet' }) assert.ok('mnemonic' in wallet) assert.ok('seed' in wallet) @@ -121,6 +123,7 @@ await suite('Lock and unlock wallets', async () => { const wallet = await Bip44Wallet.fromMnemonic(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) + //@ts-expect-error await assert.rejects(wallet.lock(1), { message: 'Failed to lock wallet' }) assert.ok('mnemonic' in wallet) assert.ok('seed' in wallet) @@ -129,6 +132,7 @@ await suite('Lock and unlock wallets', async () => { await wallet.lock(NANO_TEST_VECTORS.PASSWORD) + //@ts-expect-error await assert.rejects(wallet.unlock(1), { message: 'Failed to unlock wallet' }) assert.ok('mnemonic' in wallet) assert.ok('seed' in wallet) @@ -227,6 +231,7 @@ await suite('Lock and unlock wallets', async () => { const wallet = await Blake2bWallet.fromSeed(NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_1) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) + //@ts-expect-error await assert.rejects(wallet.lock(), { message: 'Failed to lock wallet' }) assert.ok('mnemonic' in wallet) assert.ok('seed' in wallet) @@ -235,6 +240,7 @@ await suite('Lock and unlock wallets', async () => { await wallet.lock(NANO_TEST_VECTORS.PASSWORD) + //@ts-expect-error await assert.rejects(wallet.unlock(), { message: 'Failed to unlock wallet' }) assert.ok('mnemonic' in wallet) assert.ok('seed' in wallet) @@ -248,6 +254,7 @@ await suite('Lock and unlock wallets', async () => { const wallet = await Blake2bWallet.fromSeed(NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_1) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) + //@ts-expect-error await assert.rejects(wallet.lock(1), { message: 'Failed to lock wallet' }) assert.ok('mnemonic' in wallet) assert.ok('seed' in wallet) @@ -256,6 +263,7 @@ await suite('Lock and unlock wallets', async () => { await wallet.lock(NANO_TEST_VECTORS.PASSWORD) + //@ts-expect-error await assert.rejects(wallet.unlock(1), { message: 'Failed to unlock wallet' }) assert.ok('mnemonic' in wallet) assert.ok('seed' in wallet) -- 2.47.3