File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -284,10 +284,17 @@ describe("utils", function() {
284284 expect ( validatePattern ( "blue" , rxPattern ) ) . toBeFalsy ( )
285285 } )
286286
287- it ( "returns a message for invalid pattern' " , function ( ) {
287+ it ( "returns a message for invalid pattern" , function ( ) {
288288 expect ( validatePattern ( "pink" , rxPattern ) ) . toEqual ( errorMessage )
289289 expect ( validatePattern ( "123" , rxPattern ) ) . toEqual ( errorMessage )
290290 } )
291+
292+ it ( "fails gracefully when an invalid regex value is passed" , function ( ) {
293+ expect ( ( ) => validatePattern ( "aValue" , "---" ) ) . toNotThrow ( )
294+ expect ( ( ) => validatePattern ( "aValue" , 1234 ) ) . toNotThrow ( )
295+ expect ( ( ) => validatePattern ( "aValue" , null ) ) . toNotThrow ( )
296+ expect ( ( ) => validatePattern ( "aValue" , [ ] ) ) . toNotThrow ( )
297+ } )
291298 } )
292299
293300 describe ( "validateParam" , function ( ) {
You can’t perform that action at this time.
0 commit comments