Merge pull request #847 from matiu/bug/handleInsightErrors

handle empty Insight responses
This commit is contained in:
Gustavo Maximiliano Cortez 2014-07-07 20:26:12 -03:00
commit 6e442cd902
2 changed files with 35 additions and 4 deletions

View file

@ -126,6 +126,8 @@ describe('Insight model', function() {
});
}
it('#checkActivity for innactive addreses', function(done) {
var w = new Insight();
w.getTransactions = function(addresses, cb) {
@ -176,4 +178,27 @@ describe('Insight model', function() {
done();
});
});
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();
});
});
});