Browse Source

fix browser tests

patch-2
Manuel Araoz 11 years ago
parent
commit
f1d7662a70
  1. 4
      browser/build.js
  2. 2
      lib/Connection.js
  3. 2
      test/index.html
  4. 3
      test/test.NetworkMonitor.js

4
browser/build.js

@ -24,6 +24,7 @@ var modules = [
'lib/ECIES',
'lib/Electrum',
'lib/Message',
'lib/NetworkMonitor',
'lib/Opcode',
'lib/PayPro',
'lib/Peer',
@ -101,6 +102,9 @@ var createBitcore = function(opts) {
b.require(opts.dir + 'bufferput', {
expose: 'bufferput'
});
b.require(opts.dir + 'events', {
expose: 'events'
});
b.require(opts.dir + 'buffers', {
expose: 'buffers'
});

2
lib/Connection.js

@ -18,6 +18,7 @@ var doubleSha256 = util.twoSha256;
var SecureRandom = require('./SecureRandom');
var nonce = SecureRandom.getPseudoRandomBuffer(8);
var nodeUtil = require('util');
var EventEmitter = require('events').EventEmitter;
var BIP0031_VERSION = 60000;
@ -59,7 +60,6 @@ function Connection(socket, peer, opts) {
this.setupHandlers();
}
var EventEmitter = require('events').EventEmitter;
nodeUtil.inherits(Connection, EventEmitter);
Connection.prototype.open = function(callback) {
if (typeof callback === 'function') this.once('connect', callback);

2
test/index.html

@ -10,6 +10,7 @@
<div id="mocha"></div>
<script src="../node_modules/mocha/mocha.js"></script>
<script src="../node_modules/chai/chai.js"></script>
<script src="../node_modules/sinon/pkg/sinon.js"></script>
<script>mocha.setup('bdd')</script>
<script src="../browser/bundle.js"></script>
<script src="../browser/testdata.js"></script>
@ -31,6 +32,7 @@
<script src="test.main.js"></script>
<script src="test.Message.js"></script>
<script src="test.misc.js"></script>
<script src="test.NetworkMonitor.js"></script>
<script src="test.Opcode.js"></script>
<script src="test.PayPro.js"></script>
<script src="test.Peer.js"></script>

3
test/test.NetworkMonitor.js

@ -1,7 +1,7 @@
'use strict';
var chai = chai || require('chai');
var sinon = require('sinon');
var sinon = sinon || require('sinon');
var bitcore = bitcore || require('../bitcore');
var Transaction = bitcore.Transaction;
var NetworkMonitor = bitcore.NetworkMonitor;
@ -36,6 +36,7 @@ describe('NetworkMonitor', function() {
it('should be able to start instance', function() {
var nm = new NetworkMonitor.create(config);
nm.start.bind(nm).should.not.throw();
nm.stop();
});
it('should be able to stop instance', function() {
var nm = new NetworkMonitor.create(config);

Loading…
Cancel
Save