From: Chris Duncan Date: Sat, 5 Jul 2025 10:24:58 +0000 (-0700) Subject: Remove ts directives. X-Git-Tag: v0.10.5~113 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=9cd508f4b2a36134c3b9401fbe377dc4aeb7704d;p=libnemo.git Remove ts directives. --- diff --git a/test/test.create-wallet.mjs b/test/test.create-wallet.mjs index c535359..bafffaf 100644 --- a/test/test.create-wallet.mjs +++ b/test/test.create-wallet.mjs @@ -40,7 +40,6 @@ await suite('Create wallets', async () => { await test('BIP-44 replace invalid salt with empty string', async () => { const invalidArgs = [null, true, false, 0, 1, 2, { foo: 'bar' }] for (const arg of invalidArgs) { - //@ts-expect-error const wallet = Bip44Wallet.create(NANO_TEST_VECTORS.PASSWORD, arg) await assert.resolves(wallet); (await wallet).destroy() diff --git a/test/test.lock-unlock.mjs b/test/test.lock-unlock.mjs index 72a7f50..1c30dce 100644 --- a/test/test.lock-unlock.mjs +++ b/test/test.lock-unlock.mjs @@ -119,7 +119,6 @@ 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) @@ -128,7 +127,6 @@ 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) @@ -142,7 +140,6 @@ 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) @@ -151,7 +148,6 @@ 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) @@ -269,7 +265,6 @@ 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) @@ -278,7 +273,6 @@ 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) @@ -292,7 +286,6 @@ 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) @@ -301,7 +294,6 @@ 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) diff --git a/test/test.refresh-accounts.mjs b/test/test.refresh-accounts.mjs index 055ef56..c37f34b 100644 --- a/test/test.refresh-accounts.mjs +++ b/test/test.refresh-accounts.mjs @@ -53,6 +53,7 @@ await suite('refreshing account info', { skip: false }, async () => { await test('throw when referencing invalid account index', async () => { const wallet = await Bip44Wallet.fromSeed(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) + await assert.rejects(wallet.account(0x80000000), { message: 'Invalid child key index 0x80000000' }) @@ -113,7 +114,7 @@ await suite('Fetch next unopened account', { skip: false }, async () => { await test('should throw on invalid node URL', async () => { const wallet = await Bip44Wallet.fromSeed(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) - //@ts-expect-error + await assert.rejects(wallet.getNextNewAccount()) await assert.rejects(wallet.getNextNewAccount(null)) await assert.rejects(wallet.getNextNewAccount(1)) @@ -126,14 +127,11 @@ await suite('Fetch next unopened account', { skip: false }, async () => { await test('should throw on invalid batch size', async () => { const wallet = await Bip44Wallet.fromSeed(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) - //@ts-expect-error + await assert.rejects(wallet.getNextNewAccount(rpc, null)) await assert.rejects(wallet.getNextNewAccount(rpc, -1)) - //@ts-expect-error await assert.rejects(wallet.getNextNewAccount(rpc, '')) - //@ts-expect-error await assert.rejects(wallet.getNextNewAccount(rpc, 'foo')) - //@ts-expect-error await assert.rejects(wallet.getNextNewAccount(rpc, { 'foo': 'bar' })) await wallet.destroy() @@ -147,6 +145,7 @@ await suite('Refreshing wallet accounts', { skip: false }, async () => { await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) const accounts = await wallet.refresh(rpc) const account = accounts[0] + assert.ok(account instanceof Account) assert.equals(typeof account.balance, 'bigint') assert.exists(account.frontier) @@ -159,6 +158,7 @@ await suite('Refreshing wallet accounts', { skip: false }, async () => { const wallet = await Bip44Wallet.fromSeed(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) const accounts = await wallet.refresh(rpc, 0, 2) + assert.equals(accounts.length, 1) assert.ok(accounts[0] instanceof Account)