diff --git a/test/test.blockchain.Insight.js b/test/test.blockchain.Insight.js index b96dc9cf8..18a35471f 100644 --- a/test/test.blockchain.Insight.js +++ b/test/test.blockchain.Insight.js @@ -180,29 +180,20 @@ describe('Insight model', function() { }); - it('should handle getTransaction errors', function(done) { - - var http = require('http'); - var request = { - statusCode: 200 - }; - - request.on = function(event, cb) { - if (event === 'error') return; - if (event === 'data') return cb('{ "txid": "1234" }'); - return cb(); - }; - - var req = {}; - req.write = function() {}; - req.end = function() {}; - - sinon - .stub(http, 'request') - .returns(req) - .yields(request); - + it('should handle getTransaction null response', function(done) { var w = new Insight(); + w._request = sinon.stub().yields(); + w.getTransactions(['asdasd'], function(ret) { + ret.length.should.equal(0); + done(); + }); + }); + + + + it('should handle getTransaction empty response', function(done) { + var w = new Insight(); + w._request = sinon.stub().yields([]); w.getTransactions(['asdasd'], function(ret) { ret.length.should.equal(0); done();