From a46a656c27d3daa9b37c5a03fe0286f7a522fc8b Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Mon, 25 Nov 2024 08:54:56 -0800 Subject: [PATCH] Add test for open block. --- test/sign-blocks.test.mjs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/sign-blocks.test.mjs b/test/sign-blocks.test.mjs index 05058d5..2e9001a 100644 --- a/test/sign-blocks.test.mjs +++ b/test/sign-blocks.test.mjs @@ -62,6 +62,20 @@ describe('valid blocks', async () => { }) describe('block signing tests using official test vectors', async () => { + it('should create a valid signature for an open block', async () => { + const block = new ReceiveBlock( + NANO_TEST_VECTORS.OPEN_BLOCK.account, + NANO_TEST_VECTORS.OPEN_BLOCK.balance, + NANO_TEST_VECTORS.OPEN_BLOCK.link, + '0', + NANO_TEST_VECTORS.OPEN_BLOCK.representative, + NANO_TEST_VECTORS.OPEN_BLOCK.previous, + NANO_TEST_VECTORS.OPEN_BLOCK.work + ) + await block.sign(NANO_TEST_VECTORS.OPEN_BLOCK.key) + assert.equal(block.signature, NANO_TEST_VECTORS.OPEN_BLOCK.signature) + }) + it('should create a valid signature for a receive block', async () => { const block = new ReceiveBlock( NANO_TEST_VECTORS.RECEIVE_BLOCK.account, -- 2.34.1