From 63fd660eb1b3f22d3ed100320d7d8bfe04ee527e Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 6 Dec 2013 10:20:32 +0100 Subject: [PATCH] Fix error handling in testcase --- test/unit/cartodb/req2params.test.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/unit/cartodb/req2params.test.js b/test/unit/cartodb/req2params.test.js index b1e8b12e..6b982c86 100644 --- a/test/unit/cartodb/req2params.test.js +++ b/test/unit/cartodb/req2params.test.js @@ -15,7 +15,7 @@ suite('req2params', function() { test('cleans up request', function(done){ opts.req2params({headers: { host:'localhost' }, query: {dbuser:'hacker',dbname:'secret'}}, function(err, req) { - if ( err ) { console.log(err); throw new Error(err); } + if ( err ) { done(err); return; } assert.ok(_.isObject(req.query), 'request has query'); assert.ok(!req.query.hasOwnProperty('dbuser'), 'dbuser was removed from query'); assert.ok(req.hasOwnProperty('params'), 'request has params'); @@ -28,7 +28,7 @@ suite('req2params', function() { test('sets dbname from redis metadata', function(done){ opts.req2params({headers: { host:'localhost' }, query: {} }, function(err, req) { - if ( err ) { console.log(err); throw new Error(err); } + if ( err ) { done(err); return; } //console.dir(req); assert.ok(_.isObject(req.query), 'request has query'); assert.ok(!req.query.hasOwnProperty('dbuser'), 'dbuser was removed from query'); @@ -44,7 +44,7 @@ suite('req2params', function() { test('sets also dbuser for authenticated requests', function(done){ opts.req2params({headers: { host:'localhost' }, query: {map_key: '1234'} }, function(err, req) { - if ( err ) { console.log(err); throw new Error(err); } + if ( err ) { done(err); return; } //console.dir(req); assert.ok(_.isObject(req.query), 'request has query'); assert.ok(!req.query.hasOwnProperty('dbuser'), 'dbuser was removed from query'); @@ -71,6 +71,7 @@ suite('req2params', function() { }; test_helper.lzma_compress_to_base64(JSON.stringify(qo), 1, function(err, data) { opts.req2params({ query: { non_included: 'toberemoved', api_key: 'test', style: 'override', lzma: data }}, function(err, req) { + if ( err ) { done(err); return; } var query = req.params assert.equal(qo.style, query.style) assert.equal(qo.style_version, query.style_version)