fix tests
This commit is contained in:
parent
54a98d09e5
commit
9065497cc9
3
index.js
3
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) {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user