all block integration tests working

This commit is contained in:
Manuel Araoz 2015-04-29 20:37:10 -03:00
parent 9ac13de824
commit c8c4d28d42
3 changed files with 7 additions and 5 deletions

View File

@ -48,6 +48,9 @@ Blocks.heightParam = function(req, res, next, height) {
.then(next) .then(next)
.catch(BitcoreNode.errors.Blocks.NotFound, function() { .catch(BitcoreNode.errors.Blocks.NotFound, function() {
res.status(404).send('Block with height ' + height + ' not found'); res.status(404).send('Block with height ' + height + ' not found');
})
.catch(function() {
console.log(arguments);
}); });
}; };

View File

@ -64,7 +64,7 @@ describe('BitcoreHTTP v1 blocks routes', function() {
return b.toObject(); return b.toObject();
}; };
describe.only('/blocks', function() { describe('/blocks', function() {
it('works with default parameters', function(cb) { it('works with default parameters', function(cb) {
agent.get('/v1/blocks/?from=100000') agent.get('/v1/blocks/?from=100000')
.expect(200) .expect(200)

View File

@ -109,12 +109,11 @@ BlockService.blockRPCtoBitcore = function(blockData) {
* @return {Promise} a promise that will always be rejected * @return {Promise} a promise that will always be rejected
*/ */
var blockNotFound = function(err) { var blockNotFound = function(err) {
if (err instanceof Error) { if (err.message === 'Block not found' ||
throw err; err.message === 'Block height out of range') {
}
if (err.message === 'Block not found') {
throw new errors.Blocks.NotFound(); throw new errors.Blocks.NotFound();
} }
throw err;
}; };
/** /**