From e205b991801434bec295ad2563f17169e4e0a65b Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Tue, 18 Apr 2017 11:52:11 +1000 Subject: [PATCH] tests/block: check that block.transactions exists and cleanup --- test/block.js | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/test/block.js b/test/block.js index fe38120..a427a83 100644 --- a/test/block.js +++ b/test/block.js @@ -27,7 +27,7 @@ describe('Block', function () { describe('fromBuffer/fromHex', function () { fixtures.valid.forEach(function (f) { - it('imports the block: ' + f.description + ' correctly', function () { + it('imports ' + f.description, function () { var block = Block.fromHex(f.hex) assert.strictEqual(block.version, f.version) @@ -36,6 +36,7 @@ describe('Block', function () { assert.strictEqual(block.timestamp, f.timestamp) assert.strictEqual(block.bits, f.bits) assert.strictEqual(block.nonce, f.nonce) + assert.strictEqual(!block.transactions, f.hex.length === 160) }) }) @@ -56,13 +57,13 @@ describe('Block', function () { block = Block.fromHex(f.hex) }) - it('exports the block: ' + f.description + ' correctly', function () { + it('exports ' + f.description, function () { assert.strictEqual(block.toHex(), f.hex) }) }) }) - describe('getHash', function () { + describe('getHash/getId', function () { fixtures.valid.forEach(function (f) { var block @@ -70,21 +71,8 @@ describe('Block', function () { block = Block.fromHex(f.hex) }) - it('returns ' + f.hash + ' for the block: ' + f.description, function () { + it('returns ' + f.id + ' for ' + f.description, function () { assert.strictEqual(block.getHash().toString('hex'), f.hash) - }) - }) - }) - - describe('getId', function () { - fixtures.valid.forEach(function (f) { - var block - - beforeEach(function () { - block = Block.fromHex(f.hex) - }) - - it('returns ' + f.id + ' for the block: ' + f.description, function () { assert.strictEqual(block.getId(), f.id) }) })