Added a full stack integration-style regtest for the bus

- The test exercises subscribe and calls unsubscribe.
This commit is contained in:
Chris Kleeschulte 2015-09-10 13:18:39 -04:00
parent 55a3baa1aa
commit 875c35de2a
1 changed files with 19 additions and 0 deletions

View File

@ -219,4 +219,23 @@ describe('Node Functionality', function() {
node.services.bitcoind.isMainChain(invalidatedBlockHash).should.equal(false);
setImmediate(done);
});
describe('Bus Functionality', function() {
it('subscribes and unsubscribes to an event on the bus', function(done) {
var bus = node.openBus();
var block;
bus.subscribe('db/block');
bus.on('block', function(data) {
bus.unsubscribe('db/block');
data.should.be.equal(block);
done();
});
client.generate(1, function(err, response) {
if (err) {
throw err;
}
block = response.result[0];
});
});
});
});