@@ -326,6 +326,22 @@ describe('Route', () => {
326326 expect ( called ) . to . be . false ( ) ;
327327 } ) ;
328328
329+ it ( 'throws error when the default routes payload validation is set without payload parsing' , ( ) => {
330+
331+ expect ( ( ) => {
332+
333+ Hapi . server ( { routes : { validate : { payload : { } , validator : Joi } , payload : { parse : false } } } ) ;
334+ } ) . to . throw ( 'Route payload must be set to \'parse\' when payload validation enabled' ) ;
335+ } ) ;
336+
337+ it ( 'throws error when the default routes state validation is set without state parsing' , ( ) => {
338+
339+ expect ( ( ) => {
340+
341+ Hapi . server ( { routes : { validate : { state : { } , validator : Joi } , state : { parse : false } } } ) ;
342+ } ) . to . throw ( 'Route state must be set to \'parse\' when state validation enabled' ) ;
343+ } ) ;
344+
329345 it ( 'ignores default validation on GET' , async ( ) => {
330346
331347 const server = Hapi . server ( { routes : { validate : { payload : { a : Joi . required ( ) } , validator : Joi } } } ) ;
@@ -450,20 +466,36 @@ describe('Route', () => {
450466 expect ( res . payload ) . to . contain ( 'hapi' ) ;
451467 } ) ;
452468
453- it ( 'throws when server timeout is more then socket timeout' , ( ) => {
469+ it ( 'allows payload timeout more then socket timeout' , ( ) => {
470+
471+ expect ( ( ) => {
472+
473+ Hapi . server ( { routes : { payload : { timeout : 60000 } , timeout : { socket : 12000 } } } ) ;
474+ } ) . to . not . throw ( ) ;
475+ } ) ;
476+
477+ it ( 'allows payload timeout more then socket timeout (node default)' , ( ) => {
478+
479+ expect ( ( ) => {
480+
481+ Hapi . server ( { routes : { payload : { timeout : 6000000 } } } ) ;
482+ } ) . to . not . throw ( ) ;
483+ } ) ;
484+
485+ it ( 'allows server timeout more then socket timeout' , ( ) => {
454486
455487 expect ( ( ) => {
456488
457489 Hapi . server ( { routes : { timeout : { server : 60000 , socket : 12000 } } } ) ;
458- } ) . to . throw ( 'Server timeout must be shorter than socket timeout' ) ;
490+ } ) . to . not . throw ( ) ;
459491 } ) ;
460492
461- it ( 'throws when server timeout is more then socket timeout (node default)' , ( ) => {
493+ it ( 'allows server timeout more then socket timeout (node default)' , ( ) => {
462494
463495 expect ( ( ) => {
464496
465497 Hapi . server ( { routes : { timeout : { server : 6000000 } } } ) ;
466- } ) . to . throw ( 'Server timeout must be shorter than socket timeout' ) ;
498+ } ) . to . not . throw ( ) ;
467499 } ) ;
468500
469501 it ( 'ignores large server timeout when socket timeout disabled' , ( ) => {
0 commit comments