express-response-errors
Advanced tools
Comparing version
{ | ||
"name": "express-response-errors", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Collection of custom response errors and middleware for express", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -33,10 +33,10 @@ const express = require('express') | ||
afterEach(() => { | ||
server.close() | ||
afterEach(done => { | ||
server.close(done) | ||
}) | ||
describe('Base Exception', () => { | ||
it('should set code and default message', (done) => { | ||
const handler = () => { | ||
throw new HttpError(HTTP_URI_TOO_LONG) | ||
it('should set code and default message', done => { | ||
const handler = (req, res, next) => { | ||
next(new HttpError(HTTP_URI_TOO_LONG)) | ||
} | ||
@@ -49,5 +49,5 @@ | ||
it('should set code and custom message', (done) => { | ||
const handler = () => { | ||
throw new HttpError(HTTP_URI_TOO_LONG, 'TL;DR') | ||
it('should set code and custom message', done => { | ||
const handler = (req, res, next) => { | ||
next(new HttpError(HTTP_URI_TOO_LONG, 'TL;DR')) | ||
} | ||
@@ -61,6 +61,6 @@ | ||
describe('Custom Exceptions', () => { | ||
it('should set code and default message', (done) => { | ||
const handler = () => { | ||
throw new UriTooLongError() | ||
describe('Http specific exceptions', () => { | ||
it('should set code and default message', done => { | ||
const handler = (req, res, next) => { | ||
next(new UriTooLongError()) | ||
} | ||
@@ -73,5 +73,5 @@ | ||
it('should set code and custom message', (done) => { | ||
const handler = () => { | ||
throw new UriTooLongError('TL;DR') | ||
it('should set code and custom message', done => { | ||
const handler = (req, res, next) => { | ||
next(new UriTooLongError('TL;DR')) | ||
} | ||
@@ -78,0 +78,0 @@ |
12585
0.49%