Merge pull request #207 from kleetus/bus_integration_tests

Added integration tests for the bus
This commit is contained in:
Braydon Fuller 2015-09-10 14:31:42 -04:00
commit c8b0dd0999
2 changed files with 19 additions and 2 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];
});
});
});
});

View File

@ -41,8 +41,6 @@ function Node(config) {
util.inherits(Node, EventEmitter);
util.inherits(Node, EventEmitter);
Node.prototype._setNetwork = function(config) {
if (config.network === 'testnet') {
this.network = Networks.get('testnet');