From 3ad3cb7aa9a221e573103e0458cd307898e83fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Mart=C3=ADn?= Date: Wed, 28 Mar 2018 14:02:10 +0200 Subject: [PATCH] permission denied tests --- test/unit/error_handler_factory.test.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/unit/error_handler_factory.test.js b/test/unit/error_handler_factory.test.js index f1d7b63c..a0bf41a4 100644 --- a/test/unit/error_handler_factory.test.js +++ b/test/unit/error_handler_factory.test.js @@ -53,4 +53,19 @@ describe('error-handler-factory', function () { assert.deepEqual(errorHandler, expectedError); }); + + it('permission denied error', function() { + const error = new Error('permission denied'); + const errorHandler = errorHandlerFactory(error); + const expectedError = new ErrorHandler( + error.message, + error.context, + error.detail, + error.hint, + 403, + codeToCondition[error.code] || error.name + ); + + assert.deepEqual(errorHandler, expectedError); + }); });