]> git.codecow.com Git - libnemo.git/commitdiff
Expand initialization tests for Ledger.
authorChris Duncan <chris@zoso.dev>
Thu, 10 Jul 2025 14:45:28 +0000 (07:45 -0700)
committerChris Duncan <chris@zoso.dev>
Thu, 10 Jul 2025 14:45:28 +0000 (07:45 -0700)
test/test.ledger.mjs

index 62eb225b7e4bcf2c5745d751d67c5b4fb743e2ec..fe21fa3da13991bc9f67f982bcb16c84a2e52769 100644 (file)
@@ -13,10 +13,14 @@ import { Account, LedgerWallet, ReceiveBlock, SendBlock } from '../dist/main.min
 */
 await suite('Ledger hardware wallet', { skip: false || isNode }, async () => {
 
-       let wallet = await LedgerWallet.create(), account, openBlock, sendBlock, receiveBlock
+       let wallet, account, openBlock, sendBlock, receiveBlock
 
        await test('request permissions', async () => {
+               wallet = await LedgerWallet.create()
                let status = wallet.status
+               assert.equals(status, 'DISCONNECTED')
+               assert.equals(status, wallet.status)
+
                status = await click(
                        'Reset permissions, unlock device, quit Nano app, then click to continue',
                        async () => wallet.connect()
@@ -25,7 +29,14 @@ await suite('Ledger hardware wallet', { skip: false || isNode }, async () => {
                assert.equals(status, wallet.status)
 
                status = await click(
-                       'Open Nano app on device, then click to continue',
+                       'Open Nano app on device, allow device to auto-lock, then click to continue',
+                       async () => wallet.connect()
+               )
+               assert.equals(status, 'LOCKED')
+               assert.equals(status, wallet.status)
+
+               status = await click(
+                       'Unlock device, verify Nano app is open, then click to continue',
                        async () => wallet.connect()
                )
                assert.equals(status, 'CONNECTED')