From 9ce450c142087dc35f144a3bb20065db8329c01a Mon Sep 17 00:00:00 2001 From: Yemel Jardi Date: Tue, 9 Dec 2014 18:25:49 -0300 Subject: [PATCH] Remove old tests --- index.js | 4 +- lib/transport/{message.js => messages.js} | 1 + lib/transport/{peer2.js => peer.js} | 3 +- test/transport/connection.js | 38 ----------------- test/transport/peer.js | 52 ----------------------- test/transport/peermanager.js | 42 ------------------ 6 files changed, 3 insertions(+), 137 deletions(-) rename lib/transport/{message.js => messages.js} (99%) rename lib/transport/{peer2.js => peer.js} (98%) delete mode 100644 test/transport/connection.js delete mode 100644 test/transport/peer.js delete mode 100644 test/transport/peermanager.js diff --git a/index.js b/index.js index 03a492e..b071aff 100644 --- a/index.js +++ b/index.js @@ -26,10 +26,8 @@ bitcore.util.js = require('./lib/util/js'); // transport bitcore.transport = {}; -bitcore.transport.Connection = require('./lib/transport/connection'); bitcore.transport.Peer = require('./lib/transport/peer'); -bitcore.transport.Peer2 = require('./lib/transport/peer2'); -bitcore.transport.PeerManager = require('./lib/transport/peermanager'); +bitcore.transport.Messages = require('./lib/transport/messages'); // errors thrown by the library bitcore.errors = require('./lib/errors'); diff --git a/lib/transport/message.js b/lib/transport/messages.js similarity index 99% rename from lib/transport/message.js rename to lib/transport/messages.js index 4aaec14..26bb39e 100644 --- a/lib/transport/message.js +++ b/lib/transport/messages.js @@ -10,6 +10,7 @@ var BufferReader = require('../encoding/bufferreader'); var BufferUtil = require('../util/buffer'); var Hash = require('../crypto/hash'); var Random = require('../crypto/random'); +var Transaction = require('../transaction'); var CONNECTION_NONCE = Random.getPseudoRandomBuffer(8); var PROTOCOL_VERSION = 70000; diff --git a/lib/transport/peer2.js b/lib/transport/peer.js similarity index 98% rename from lib/transport/peer2.js rename to lib/transport/peer.js index 3b38bc1..bdb03a2 100644 --- a/lib/transport/peer2.js +++ b/lib/transport/peer.js @@ -3,12 +3,11 @@ var Buffers = require('buffers'); var EventEmitter = require('events').EventEmitter; var Net = require('net'); -var Put = require('bufferput'); var Socks5Client = require('socks5-client'); var util = require('util'); var Networks = require('../networks'); -var Messages = require('./message'); +var Messages = require('./messages'); var MAX_RECEIVE_BUFFER = 10000000; diff --git a/test/transport/connection.js b/test/transport/connection.js deleted file mode 100644 index 9826fa0..0000000 --- a/test/transport/connection.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -var chai = require('chai'); -var bitcore = require('../..'); - -var should = chai.should(); - -var ConnectionModule = bitcore.transport.Connection; -var Connection; -var nop = function() {}; - -describe('Connection', function() { - it('should initialze the main object', function() { - should.exist(ConnectionModule); - }); - - it('should be able to create class', function() { - Connection = ConnectionModule; - should.exist(Connection); - }); - - it('should be able to create instance', function() { - var mSocket = {server: null, addListener: nop}, - mPeer; - var c = new Connection(mSocket, mPeer); - should.exist(c); - }); - - if (typeof process !== 'undefined' && process.versions) { //node-only tests - it('should create a proxied socket if instructed', function() { - var mPeer; - var c = new Connection(null, mPeer, { - proxy: { host: 'localhost', port: 9050 } - }); - should.exist(c.socket); - }); - }; -}); diff --git a/test/transport/peer.js b/test/transport/peer.js deleted file mode 100644 index b23c63b..0000000 --- a/test/transport/peer.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; - -var chai = require('chai'); -var bitcore = require('../..'); - -var should = chai.should(); - -var PeerModule = bitcore.transport.Peer; -var Peer; - -describe('Peer', function() { - it('should initialze the main object', function() { - should.exist(PeerModule); - }); - - it('should be able to create class', function() { - Peer = PeerModule; - should.exist(Peer); - }); - - it('should be able to create instance', function() { - var p = new Peer('localhost', 8333); - should.exist(p); - }); - - it('should be able to create instance', function() { - var p = new Peer('localhost:8333'); - should.exist(p); - }); - - it('should be able to create instance', function() { - var p = new Peer('localhost:8333'); - var p2 = new Peer(p); - should.exist(p2); - }); - - it('should not be able to create instance', function() { - should.throw(function() { - new Peer(8333); - }); - }); - - it('should be able to create instance', function() { - var p = new Peer('localhost', 8333); - p.toString().should.equal('localhost:8333'); - }); - - it('check host as buffer', function() { - var p = new Peer('127.0.0.1', 8333); - p.getHostAsBuffer().toString('hex').should.equal('7f000001'); - }); -}); diff --git a/test/transport/peermanager.js b/test/transport/peermanager.js deleted file mode 100644 index 60a13ee..0000000 --- a/test/transport/peermanager.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -var chai = require('chai'); -var bitcore = require('../..'); - -var should = chai.should(); - -var PeerManager = bitcore.transport.PeerManager; - -describe('PeerManager', function() { - it('should be able to create class', function() { - should.exist(PeerManager); - }); - - it('should be able to create instance', function() { - var pm = new PeerManager(); - should.exist(pm); - }); - - it('should be able to start instance', function() { - var pm = new PeerManager(); - pm.start.bind(pm).should.not.throw(); - }); - - it('should be able to stop instance', function() { - var pm = new PeerManager(); - pm.start(); - pm.stop.bind(pm).should.not.throw(); - }); - - it('should extend default config with passed config', function() { - var pm = new PeerManager({ - proxy: { - host: 'localhost', - port: 9050 - } - }); - - should.exist(pm.config.network); - should.exist(pm.config.proxy); - }); -});