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.nm = nm;
|
||||||
|
|
||||||
this.bus.register(bitcore.Transaction, function(tx) {
|
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) {
|
this.bus.register(bitcore.Block, function(block) {
|
||||||
|
|||||||
@ -57,18 +57,20 @@ describe('EventBus', function() {
|
|||||||
bus.process(foo);
|
bus.process(foo);
|
||||||
});
|
});
|
||||||
var b1 = new BarEvent();
|
var b1 = new BarEvent();
|
||||||
b1.x = 42;
|
b1.y = 42;
|
||||||
var b2 = new BarEvent();
|
var b2 = new BarEvent();
|
||||||
b2.x = 69;
|
b2.y = 69;
|
||||||
it('foo returns two bars', function() {
|
it('foo returns two bars', function(cb) {
|
||||||
var bus = new EventBus();
|
var bus = new EventBus();
|
||||||
var spy = sinon.spy();
|
var spy = sinon.spy();
|
||||||
bus.register(FooEvent, function() {
|
bus.register(FooEvent, function() {
|
||||||
return [b1, b2];
|
return [b1, b2];
|
||||||
});
|
});
|
||||||
bus.register(BarEvent, spy);
|
bus.register(BarEvent, spy);
|
||||||
bus.process(foo);
|
bus.process(foo).then(function() {
|
||||||
spy.callCount.should.equal(2);
|
spy.callCount.should.equal(2);
|
||||||
|
cb();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('foo returns two bars and emits external events', function(cb) {
|
it('foo returns two bars and emits external events', function(cb) {
|
||||||
var bus = new EventBus();
|
var bus = new EventBus();
|
||||||
@ -104,7 +106,7 @@ describe('EventBus', function() {
|
|||||||
return Promise.resolve([b1, b2]).delay(1);
|
return Promise.resolve([b1, b2]).delay(1);
|
||||||
});
|
});
|
||||||
bus.register(BarEvent, function(e) {
|
bus.register(BarEvent, function(e) {
|
||||||
if (e.x === b1.x) {
|
if (e.y === b1.y) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user