@@ -459,4 +459,73 @@ describe("Tests that app does not crashes (no hard-fail asserts)", function () {
459459 }
460460 expect ( exceptionThrown ) . toBe ( true ) ;
461461 } ) ;
462+
463+ it ( "When_require_is_called_with_wrong_number_of_arguments" , function ( ) {
464+ var exceptionThrown = false ;
465+ try {
466+ var r = require ( /* no arguments */ ) ;
467+ } catch ( e ) {
468+ exceptionThrown = true ;
469+ }
470+ expect ( exceptionThrown ) . toBe ( true ) ;
471+
472+ exceptionThrown = false ;
473+ try {
474+ var r = require ( 1 , 2 /* two arguments */ ) ;
475+ } catch ( e ) {
476+ exceptionThrown = true ;
477+ }
478+ expect ( exceptionThrown ) . toBe ( true ) ;
479+ } ) ;
480+
481+ it ( "When_require_is_called_with_wrong_type_of_arguments" , function ( ) {
482+ var f = require ;
483+ var exceptionThrown = false ;
484+ try {
485+ var val = f ( null ) ;
486+ } catch ( e ) {
487+ exceptionThrown = true ;
488+ }
489+ expect ( exceptionThrown ) . toBe ( true ) ;
490+
491+ exceptionThrown = false ;
492+ try {
493+ var val = f ( { } ) ;
494+ } catch ( e ) {
495+ exceptionThrown = true ;
496+ }
497+ expect ( exceptionThrown ) . toBe ( true ) ;
498+
499+ exceptionThrown = false ;
500+ try {
501+ var val = f ( undefined ) ;
502+ } catch ( e ) {
503+ exceptionThrown = true ;
504+ }
505+ expect ( exceptionThrown ) . toBe ( true ) ;
506+
507+ exceptionThrown = false ;
508+ try {
509+ var val = f ( false ) ;
510+ } catch ( e ) {
511+ exceptionThrown = true ;
512+ }
513+ expect ( exceptionThrown ) . toBe ( true ) ;
514+
515+ exceptionThrown = false ;
516+ try {
517+ var val = f ( true ) ;
518+ } catch ( e ) {
519+ exceptionThrown = true ;
520+ }
521+ expect ( exceptionThrown ) . toBe ( true ) ;
522+
523+ exceptionThrown = false ;
524+ try {
525+ var val = f ( 0 ) ;
526+ } catch ( e ) {
527+ exceptionThrown = true ;
528+ }
529+ expect ( exceptionThrown ) . toBe ( true ) ;
530+ } ) ;
462531} ) ;
0 commit comments