]> zoso.dev Git - libnemo.git/commitdiff
Update tools test.
authorChris Duncan <chris@zoso.dev>
Mon, 25 Nov 2024 20:53:37 +0000 (12:53 -0800)
committerChris Duncan <chris@zoso.dev>
Mon, 25 Nov 2024 20:53:37 +0000 (12:53 -0800)
test/tools.test.mjs

index cbe4507ce8e9c0c674baa365b4d1ed4f0007363d..b9a7bf29f3008bb9f29183c42937ae0f14773d16 100644 (file)
@@ -101,33 +101,35 @@ describe('signature tests', async () => {
 \r
        it('should verify a block using the public key', async () => {\r
                const accounts = await wallet.accounts()\r
+               const account = accounts[0]\r
                const sendBlock = new SendBlock(\r
-                       accounts[0].address,\r
+                       account.address,\r
                        '5618869000000000000000000000000',\r
                        'nano_1q3hqecaw15cjt7thbtxu3pbzr1eihtzzpzxguoc37bj1wc5ffoh7w74gi6p',\r
                        '2000000000000000000000000000000',\r
                        'nano_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou',\r
                        '92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D',\r
                )\r
-               await sendBlock.sign(accounts[0].privateKey)\r
-               const valid = await sendBlock.verify(accounts[0].publicKey)\r
+               await sendBlock.sign(account.privateKey)\r
+               const valid = await sendBlock.verify(account.publicKey)\r
                assert.equal(valid, true)\r
        })\r
 \r
        it('should reject a block using the wrong public key', async () => {\r
                const accounts = await wallet.accounts()\r
+               const account = accounts[0]\r
                const sendBlock = new SendBlock(\r
-                       accounts[0].address,\r
+                       account.address,\r
                        '5618869000000000000000000000000',\r
                        'nano_1q3hqecaw15cjt7thbtxu3pbzr1eihtzzpzxguoc37bj1wc5ffoh7w74gi6p',\r
                        '2000000000000000000000000000000',\r
                        'nano_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou',\r
                        '92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D',\r
                )\r
-               sendBlock.sign(accounts[0].privateKey)\r
+               sendBlock.sign(account.privateKey)\r
 \r
                sendBlock.account = new Account('nano_1q3hqecaw15cjt7thbtxu3pbzr1eihtzzpzxguoc37bj1wc5ffoh7w74gi6p')\r
-               const valid = await sendBlock.verify(accounts[0].publicKey)\r
+               const valid = await sendBlock.verify(account.publicKey)\r
                assert.equal(valid, false)\r
        })\r
 \r