@@ -40,18 +40,6 @@ describe('ValidationErrorMiddleware (unit)', () => {
4040 expect ( result ) . to . equal ( 'success' ) ;
4141 expect ( next . calledOnce ) . to . be . true ( ) ;
4242 } ) ;
43-
44- it ( 're-throws errors for non-matching endpoints' , async ( ) => {
45- const middleware = await provider . value ( ) ;
46- const error = new HttpErrors . BadRequest ( 'Test error' ) ;
47- const next = sinon . stub ( ) . rejects ( error ) ;
48-
49- middlewareContext . request . url = '/other-endpoint' ;
50-
51- await expect ( middleware ( middlewareContext , next ) ) . to . be . rejectedWith (
52- 'Test error' ,
53- ) ;
54- } ) ;
5543 } ) ;
5644
5745 describe ( 'handleError() for /coffee-shops endpoint' , ( ) => {
@@ -206,35 +194,6 @@ describe('ValidationErrorMiddleware (unit)', () => {
206194 } ) ;
207195 } ) ;
208196
209- describe ( 'handleError() for other endpoints' , ( ) => {
210- it ( 'does not customize errors for other URLs' , async ( ) => {
211- const middleware = await provider . value ( ) ;
212- const error = new HttpErrors . UnprocessableEntity ( 'Validation failed' ) ;
213- error . statusCode = 422 ;
214- const next = sinon . stub ( ) . rejects ( error ) ;
215-
216- middlewareContext . request . url = '/other-endpoint' ;
217- middlewareContext . request . method = 'PATCH' ;
218-
219- await expect ( middleware ( middlewareContext , next ) ) . to . be . rejectedWith (
220- 'Validation failed' ,
221- ) ;
222- } ) ;
223-
224- it ( 'passes through errors for non-matching endpoints' , async ( ) => {
225- const middleware = await provider . value ( ) ;
226- const error = new HttpErrors . InternalServerError ( 'Server error' ) ;
227- const next = sinon . stub ( ) . rejects ( error ) ;
228-
229- middlewareContext . request . url = '/api/users' ;
230- middlewareContext . request . method = 'POST' ;
231-
232- await expect ( middleware ( middlewareContext , next ) ) . to . be . rejectedWith (
233- 'Server error' ,
234- ) ;
235- } ) ;
236- } ) ;
237-
238197 describe ( 'error writer options' , ( ) => {
239198 it ( 'works without error writer options' , async ( ) => {
240199 provider = new ValidationErrorMiddlewareProvider ( logErrorStub ) ;
0 commit comments