]> git.codecow.com Git - libnemo.git/commitdiff
Fix test descriptions. Add tsc ignore directives for lock and unlock parameter type...
authorChris Duncan <chris@zoso.dev>
Thu, 3 Jul 2025 21:14:27 +0000 (14:14 -0700)
committerChris Duncan <chris@zoso.dev>
Thu, 3 Jul 2025 21:14:27 +0000 (14:14 -0700)
test/test.lock-unlock-wallet.mjs

index 71b372c30e228538f9f9953c3eb162e272bac27d..2252f046c3829a37620deda0deb19d592d17b19b 100644 (file)
@@ -28,7 +28,7 @@ await suite('Lock and unlock wallets', async () => {
                await wallet.destroy()\r
        })\r
 \r
-       await test('locking and unlocking a Bip44Wallet with a random CryptoKey', async () => {\r
+       await test('locking and unlocking a Bip44Wallet with random bytes', async () => {\r
                const wallet = await Bip44Wallet.fromMnemonic(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)\r
                await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                const key = await globalThis.crypto.subtle.generateKey({ name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt'])\r
@@ -66,7 +66,7 @@ await suite('Lock and unlock wallets', async () => {
                await wallet.destroy()\r
        })\r
 \r
-       await test('fail to unlock a Bip44Wallet with different keys', async () => {\r
+       await test('fail to unlock a Bip44Wallet with different random bytes', async () => {\r
                const wallet = await Bip44Wallet.fromMnemonic(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)\r
                await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                const rightKey = await globalThis.crypto.subtle.generateKey({ name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt'])\r
@@ -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)\r
                await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
 \r
+               //@ts-expect-error\r
                await assert.rejects(wallet.lock(), { message: 'Failed to lock wallet' })\r
                assert.ok('mnemonic' in wallet)\r
                assert.ok('seed' in wallet)\r
@@ -108,6 +109,7 @@ await suite('Lock and unlock wallets', async () => {
 \r
                await wallet.lock('password')\r
 \r
+               //@ts-expect-error\r
                await assert.rejects(wallet.unlock(), { message: 'Failed to unlock wallet' })\r
                assert.ok('mnemonic' in wallet)\r
                assert.ok('seed' in wallet)\r
@@ -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)\r
                await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
 \r
+               //@ts-expect-error\r
                await assert.rejects(wallet.lock(1), { message: 'Failed to lock wallet' })\r
                assert.ok('mnemonic' in wallet)\r
                assert.ok('seed' in wallet)\r
@@ -129,6 +132,7 @@ await suite('Lock and unlock wallets', async () => {
 \r
                await wallet.lock(NANO_TEST_VECTORS.PASSWORD)\r
 \r
+               //@ts-expect-error\r
                await assert.rejects(wallet.unlock(1), { message: 'Failed to unlock wallet' })\r
                assert.ok('mnemonic' in wallet)\r
                assert.ok('seed' in wallet)\r
@@ -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)\r
                await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
 \r
+               //@ts-expect-error\r
                await assert.rejects(wallet.lock(), { message: 'Failed to lock wallet' })\r
                assert.ok('mnemonic' in wallet)\r
                assert.ok('seed' in wallet)\r
@@ -235,6 +240,7 @@ await suite('Lock and unlock wallets', async () => {
 \r
                await wallet.lock(NANO_TEST_VECTORS.PASSWORD)\r
 \r
+               //@ts-expect-error\r
                await assert.rejects(wallet.unlock(), { message: 'Failed to unlock wallet' })\r
                assert.ok('mnemonic' in wallet)\r
                assert.ok('seed' in wallet)\r
@@ -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)\r
                await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
 \r
+               //@ts-expect-error\r
                await assert.rejects(wallet.lock(1), { message: 'Failed to lock wallet' })\r
                assert.ok('mnemonic' in wallet)\r
                assert.ok('seed' in wallet)\r
@@ -256,6 +263,7 @@ await suite('Lock and unlock wallets', async () => {
 \r
                await wallet.lock(NANO_TEST_VECTORS.PASSWORD)\r
 \r
+               //@ts-expect-error\r
                await assert.rejects(wallet.unlock(1), { message: 'Failed to unlock wallet' })\r
                assert.ok('mnemonic' in wallet)\r
                assert.ok('seed' in wallet)\r