all block integration tests working
This commit is contained in:
parent
9ac13de824
commit
c8c4d28d42
@ -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);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user