From: Chris Duncan Date: Thu, 6 Aug 2026 10:14:59 +0000 (-0700) Subject: Ignore click delay for automated testing. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=3272382965c712a15169287263efa369bea97fc6;p=libnemo.git Ignore click delay for automated testing. --- diff --git a/test/test.blocks.mjs b/test/test.blocks.mjs index 0278cea..5b43f3e 100644 --- a/test/test.blocks.mjs +++ b/test/test.blocks.mjs @@ -17,7 +17,7 @@ await Promise.all([ await assert.resolves(click( 'Sign and autogen PoW when processing', async () => block.sign(OPEN_BLOCK.key), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.nullish(block.work) @@ -113,7 +113,7 @@ await Promise.all([ await assert.resolves(click( 'Sign with BLAKE2b', async () => wallet.sign(1, block), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.ok(await block.verify(BLAKE2B_PUBLIC_1)) @@ -129,7 +129,7 @@ await Promise.all([ await assert.resolves(click( 'Sign with BIP-44', async () => wallet.sign(0, block), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.ok(await block.verify(PUBLIC_0)) @@ -145,7 +145,7 @@ await Promise.all([ await assert.resolves(click( 'Sign with Exodus', async () => wallet.sign(0, block), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.ok(await block.verify(EXODUS.PUBLIC_0)) @@ -172,7 +172,7 @@ await Promise.all([ await assert.rejects(click( 'Fail to sign while locked', async () => wallet.sign(0, block), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.ok(block.signature === undefined) @@ -187,7 +187,7 @@ await Promise.all([ await assert.resolves(click( 'Sign open block with key', async () => block.sign(OPEN_BLOCK.key), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.equal(block.hash, OPEN_BLOCK.hash) assert.equal(block.signature, OPEN_BLOCK.signature) @@ -201,7 +201,7 @@ await Promise.all([ await assert.resolves(click( 'Sign receive block with key', async () => block.sign(RECEIVE_BLOCK.key), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.equal(block.hash, RECEIVE_BLOCK.hash) @@ -215,7 +215,7 @@ await Promise.all([ await assert.resolves(click( 'Sign receive block without work', async () => block.sign(RECEIVE_BLOCK.key), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.equal(block.hash, RECEIVE_BLOCK.hash) @@ -236,7 +236,7 @@ await Promise.all([ await assert.resolves(click( 'Sign Ledger-derived block using BIP-44 wallet', async () => wallet.sign(0, block), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.equal(block.signature, LEDGER_NANOS.OPEN_BLOCK.signature) @@ -253,7 +253,7 @@ await Promise.all([ await assert.resolves(click( 'Sign send block with key', async () => block.sign(SEND_BLOCK.key), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.equal(block.hash, SEND_BLOCK.hash) @@ -267,7 +267,7 @@ await Promise.all([ await assert.resolves(click( 'Sign send block without work', async () => block.sign(SEND_BLOCK.key), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.equal(block.hash, SEND_BLOCK.hash) @@ -285,7 +285,7 @@ await Promise.all([ await assert.resolves(click( 'Sign change block with key', async () => block.sign('781186FB9EF17DB6E3D1056550D9FAE5D5BBADA6A6BC370E4CBB938B1DC71DA3'), // Did not find a private key at nano docs for this address - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.equal(block.signature?.toUpperCase(), 'A3C3C66D6519CBC0A198E56855942DEACC6EF741021A1B11279269ADC587DE1DA53CD478B8A47553231104CF24D742E1BB852B0546B87038C19BAE20F9082B0D') @@ -299,7 +299,7 @@ await Promise.all([ await assert.resolves(click( 'Sign change block without work', async () => block.sign(PRIVATE_0), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.equal(block.signature?.toUpperCase(), '2BD2F905E74B5BEE3E2277CED1D1E3F7535E5286B6E22F7B08A814AA9E5C4E1FEA69B61D60B435ADC2CE756E6EE5F5BE7EC691FE87E024A0B22A3D980CA5B305') @@ -315,7 +315,7 @@ await Promise.all([ 'fail to sign without args', //@ts-expect-error async () => block.sign(), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.nullish(block.signature) @@ -323,21 +323,21 @@ await Promise.all([ 'fail to sign with null arg', //@ts-expect-error async () => block.sign(null), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.nullish(block.signature) await assert.rejects(click( 'fail to sign with invalid string length', async () => block.sign('1'), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.nullish(block.signature) await assert.rejects(click( 'fail to sign with invalid string characters', async () => block.sign('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.nullish(block.signature) }) diff --git a/test/test.ledger.mjs b/test/test.ledger.mjs index 6db6f67..945dab1 100644 --- a/test/test.ledger.mjs +++ b/test/test.ledger.mjs @@ -54,7 +54,7 @@ await Promise.all([ await click( 'Reset permissions, then click to continue', async () => { }, - { delay: 6 } + { delay: isNode ? 0 : 6 } ) await assert.rejects(wallet.unlock()) assert.equal(wallet.isLocked, true) diff --git a/test/test.manage-rolodex.mjs b/test/test.manage-rolodex.mjs index 5a78f31..a087ad1 100644 --- a/test/test.manage-rolodex.mjs +++ b/test/test.manage-rolodex.mjs @@ -192,7 +192,7 @@ await Promise.all([ async () => { signature = await Tools.sign(NANO_TEST_VECTORS.PRIVATE_0 + NANO_TEST_VECTORS.PUBLIC_0, data) }, - { delay: 6 } + { delay: isNode ? 0 : 6 } )) await assert.resolves(Rolodex.add('JohnDoe', NANO_TEST_VECTORS.ADDRESS_0)) @@ -210,7 +210,7 @@ await Promise.all([ async () => { signature = await Tools.sign(NANO_TEST_VECTORS.PRIVATE_0 + NANO_TEST_VECTORS.PUBLIC_0, data) }, - { delay: 6 } + { delay: isNode ? 0 : 6 } )) await assert.resolves(Rolodex.add('JaneSmith', NANO_TEST_VECTORS.ADDRESS_1)) diff --git a/test/test.tools.mjs b/test/test.tools.mjs index 5f6a307..8b9084f 100644 --- a/test/test.tools.mjs +++ b/test/test.tools.mjs @@ -107,7 +107,7 @@ await Promise.all([ async () => { result = Tools.sign(NANO_TEST_VECTORS.PRIVATE_0 + NANO_TEST_VECTORS.PUBLIC_0, m) }, - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.equal(result.toLowerCase(), '0ceebbc0b9b3a270a30bad1eef4eddc0931effd8d5c0b7cab007fcc61f30d3ee9760cd93d7eeb5b654ecc0d9d17bc7a6d53bee54aa163a8272f425fb1184e30e') diff --git a/test/test.wallet-sign.mjs b/test/test.wallet-sign.mjs index 71c67e2..625234a 100644 --- a/test/test.wallet-sign.mjs +++ b/test/test.wallet-sign.mjs @@ -23,7 +23,7 @@ await Promise.all([ async () => { signature = await wallet.sign(0, data) }, - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.ok(await Tools.verify(account.publicKey, signature, data)) await assert.resolves(wallet.destroy()) @@ -39,7 +39,7 @@ await Promise.all([ await assert.resolves(click( 'Sign to test subsequent verification success', async () => sendBlock.sign(wallet, 0), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.ok(await sendBlock.verify(account.publicKey)) @@ -56,7 +56,7 @@ await Promise.all([ await assert.resolves(click( 'Sign to test subsequent verification failure', async () => sendBlock.sign(wallet, 0), - { delay: 6 } + { delay: isNode ? 0 : 6 } )) assert.ok(await sendBlock.verify(account.publicKey))