From 63d9329afdbd05a985223b2ec93cbcfd104fe40e Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Wed, 4 May 2016 16:06:53 +0200 Subject: [PATCH] add additional test case --- test/unit/middleware/sendJSON.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/unit/middleware/sendJSON.js b/test/unit/middleware/sendJSON.js index 0bc21911..d02138ff 100644 --- a/test/unit/middleware/sendJSON.js +++ b/test/unit/middleware/sendJSON.js @@ -206,6 +206,24 @@ module.exports.tests.search_phase_execution_exception = function(test, common) { }); }; +module.exports.tests.unknown_exception = function(test, common) { + test('unknown exception', function(t) { + var res = { body: { geocoding: { + errors: [ 'MadeUpExceptionName[ foo ]' ] + }}}; + + res.status = function( code ){ + return { json: function( body ){ + t.equal( code, 400, '400 Bad Request' ); + t.deepEqual( body, res.body, 'body set' ); + t.end(); + }}; + }; + + middleware(null, res); + }); +}; + module.exports.all = function (tape, common) { function test(name, testFunction) {