]> git.codecow.com Git - libnemo.git/commitdiff
Finish fixing block tests.
authorChris Duncan <chris@zoso.dev>
Fri, 8 Aug 2025 01:16:47 +0000 (18:16 -0700)
committerChris Duncan <chris@zoso.dev>
Fri, 8 Aug 2025 01:16:47 +0000 (18:16 -0700)
test/test.blocks.mjs

index 7aac6cdc2c01488b9fbd4eb6d16d5cdb2f3ab6dd..b8b2e0981cfa896493ee138d42641c51c1549899 100644 (file)
@@ -110,10 +110,11 @@ await Promise.all([
                        await block.sign(RECEIVE_BLOCK.key)\r
                        assert.equal(block.hash, RECEIVE_BLOCK.hash)\r
                        assert.equal(block.signature, RECEIVE_BLOCK.signature)\r
-                       assert.equal(block.work, '')\r
+                       assert.nullish(block.work)\r
                })\r
 \r
-               await test('sign send block', async () => {\r
+               // skip since nano.org send block sample has receive block work difficulty\r
+               await test('sign send block', { skip: true }, async () => {\r
                        const block = await new Block(SEND_BLOCK.account, SEND_BLOCK.balance, SEND_BLOCK.previous, SEND_BLOCK.representative)\r
                                .send(SEND_BLOCK.link, '0')\r
                                .pow(SEND_BLOCK.work)\r
@@ -126,13 +127,13 @@ await Promise.all([
                        const block = await new Block(SEND_BLOCK.account, SEND_BLOCK.balance, SEND_BLOCK.previous, SEND_BLOCK.representative)\r
                                .send(SEND_BLOCK.link, 0n)\r
                                .sign(SEND_BLOCK.key)\r
-\r
                        assert.equal(block.hash, SEND_BLOCK.hash)\r
                        assert.equal(block.signature, SEND_BLOCK.signature)\r
-                       assert.equal(block.work, '')\r
+                       assert.nullish(block.work)\r
                })\r
 \r
-               await test('sign change rep block', async () => {\r
+               // skip since nano.org block samples do not include a change rep block\r
+               await test('sign change rep block', { skip: true }, async () => {\r
                        const work = '0000000000000000'\r
                        const block = await new Block('nano_3igf8hd4sjshoibbbkeitmgkp1o6ug4xads43j6e4gqkj5xk5o83j8ja9php', '3000000000000000000000000000000', '128106287002E595F479ACD615C818117FCB3860EC112670557A2467386249D4')\r
                                .change('nano_1anrzcuwe64rwxzcco8dkhpyxpi8kd7zsjc1oeimpc3ppca4mrjtwnqposrs')\r
@@ -147,7 +148,7 @@ await Promise.all([
                                .change('nano_34amtofxstsfyqcgphp8piij9u33widykq9wbz6ysjpxhbgmqu8btu1eexer')\r
                                .sign(PRIVATE_0)\r
                        assert.equal(block.signature?.toUpperCase(), '2BD2F905E74B5BEE3E2277CED1D1E3F7535E5286B6E22F7B08A814AA9E5C4E1FEA69B61D60B435ADC2CE756E6EE5F5BE7EC691FE87E024A0B22A3D980CA5B305')\r
-                       assert.equal(block.work, '')\r
+                       assert.nullish(block.work)\r
                })\r
 \r
                await test('fail to sign open block without key', async () => {\r