From 9065497cc942eeff55a6bd4753b6c3138ef8b781 Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Mon, 2 Mar 2015 15:16:52 -0300 Subject: [PATCH] fix tests --- index.js | 3 ++- test/eventbus.js | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 0d8fe38f..4b36501e 100755 --- a/index.js +++ b/index.js @@ -17,7 +17,8 @@ var BitcoreNode = function(bus, nm) { this.nm = nm; this.bus.register(bitcore.Transaction, function(tx) { - console.log('Transaction:', tx.id, 'total_out:', Unit.fromSatoshis(tx.outputAmount).toBTC()); + var tout = Unit.fromSatoshis(tx.outputAmount).toBTC(); + console.log('Transaction:', tx.id, 'total_out:', tout, 'BTC'); }); this.bus.register(bitcore.Block, function(block) { diff --git a/test/eventbus.js b/test/eventbus.js index b890f290..8c4989e9 100644 --- a/test/eventbus.js +++ b/test/eventbus.js @@ -57,18 +57,20 @@ describe('EventBus', function() { bus.process(foo); }); var b1 = new BarEvent(); - b1.x = 42; + b1.y = 42; var b2 = new BarEvent(); - b2.x = 69; - it('foo returns two bars', function() { + b2.y = 69; + it('foo returns two bars', function(cb) { var bus = new EventBus(); var spy = sinon.spy(); bus.register(FooEvent, function() { return [b1, b2]; }); bus.register(BarEvent, spy); - bus.process(foo); - spy.callCount.should.equal(2); + bus.process(foo).then(function() { + spy.callCount.should.equal(2); + cb(); + }); }); it('foo returns two bars and emits external events', function(cb) { var bus = new EventBus(); @@ -104,7 +106,7 @@ describe('EventBus', function() { return Promise.resolve([b1, b2]).delay(1); }); bus.register(BarEvent, function(e) { - if (e.x === b1.x) { + if (e.y === b1.y) { throw err; } });