@@ -314,6 +314,33 @@ describe("Validation", () => {
314
314
} ,
315
315
} ) ;
316
316
317
+ createSuccessTestCase ( "enum with undefinedAsNull" , {
318
+ // eslint-disable-next-line no-undefined
319
+ enumKeywordAndUndefined : undefined ,
320
+ } ) ;
321
+
322
+ createSuccessTestCase ( "enum with undefinedAsNull #2" , {
323
+ enumKeywordAndUndefined : 0 ,
324
+ } ) ;
325
+
326
+ createSuccessTestCase ( "array with enum and undefinedAsNull" , {
327
+ arrayStringAndEnum : [ "a" , "b" , "c" ] ,
328
+ } ) ;
329
+
330
+ createSuccessTestCase ( "array with enum and undefinedAsNull #2" , {
331
+ // eslint-disable-next-line no-undefined
332
+ arrayStringAndEnum : [ undefined , false , undefined , 0 , "test" , undefined ] ,
333
+ } ) ;
334
+
335
+ createSuccessTestCase ( "array with enum and undefinedAsNull #3" , {
336
+ // eslint-disable-next-line no-undefined
337
+ arrayStringAndEnum : [ undefined , null , false , 0 , "" ] ,
338
+ } ) ;
339
+
340
+ createSuccessTestCase ( "string and undefinedAsNull #3" , {
341
+ stringTypeAndUndefinedAsNull : "test" ,
342
+ } ) ;
343
+
317
344
// The "name" option
318
345
createFailedTestCase (
319
346
"webpack name" ,
@@ -2987,4 +3014,46 @@ describe("Validation", () => {
2987
3014
} ,
2988
3015
( msg ) => expect ( msg ) . toMatchSnapshot ( )
2989
3016
) ;
3017
+
3018
+ createFailedTestCase (
3019
+ "enum and undefinedAsNull" ,
3020
+ {
3021
+ enumKeywordAndUndefined : "foo" ,
3022
+ } ,
3023
+ ( msg ) => expect ( msg ) . toMatchSnapshot ( )
3024
+ ) ;
3025
+
3026
+ createFailedTestCase (
3027
+ "array with enum and undefinedAsNull" ,
3028
+ {
3029
+ arrayStringAndEnum : [ "foo" , "bar" , 1 ] ,
3030
+ } ,
3031
+ ( msg ) => expect ( msg ) . toMatchSnapshot ( )
3032
+ ) ;
3033
+
3034
+ createFailedTestCase (
3035
+ "array with enum and undefinedAsNull #2" ,
3036
+ {
3037
+ // eslint-disable-next-line no-undefined
3038
+ arrayStringAndEnum : [ "foo" , "bar" , undefined , 1 ] ,
3039
+ } ,
3040
+ ( msg ) => expect ( msg ) . toMatchSnapshot ( )
3041
+ ) ;
3042
+
3043
+ createFailedTestCase (
3044
+ "array with enum and undefinedAsNull #3" ,
3045
+ {
3046
+ // eslint-disable-next-line no-undefined
3047
+ arrayStringAndEnumAndNoUndefined : [ "foo" , "bar" , undefined ] ,
3048
+ } ,
3049
+ ( msg ) => expect ( msg ) . toMatchSnapshot ( )
3050
+ ) ;
3051
+
3052
+ createFailedTestCase (
3053
+ "string and undefinedAsNull" ,
3054
+ {
3055
+ stringTypeAndUndefinedAsNull : 1 ,
3056
+ } ,
3057
+ ( msg ) => expect ( msg ) . toMatchSnapshot ( )
3058
+ ) ;
2990
3059
} ) ;
0 commit comments