@@ -61,21 +61,29 @@ function newTestLocaleInfo() {
61
61
}
62
62
63
63
64
- describe ( " findLocaleId" , function ( ) {
65
- it ( " should find the id from numbers" , function ( ) {
66
- expect ( findLocaleId ( " NumberFormatSymbols_en_GB" , " num" ) ) . toEqual ( " en_GB" ) ;
64
+ describe ( ' findLocaleId' , function ( ) {
65
+ it ( ' should find the id from numbers' , function ( ) {
66
+ expect ( findLocaleId ( ' NumberFormatSymbols_en_GB' , ' num' ) ) . toEqual ( ' en_GB' ) ;
67
67
} ) ;
68
68
69
69
70
- it ( "should find the id from datetime" , function ( ) {
71
- expect ( findLocaleId ( "DateTimeSymbols_en_ISO" , "datetime" ) ) . toEqual ( "en_ISO" ) ;
70
+ it ( 'should find the id from datetime' , function ( ) {
71
+ expect ( findLocaleId ( 'DateTimeSymbols_en' , 'datetime' ) ) . toBe ( 'en' ) ;
72
+ expect ( findLocaleId ( 'DateTimeSymbols_en_ISO' , 'datetime' ) ) . toEqual ( 'en_ISO' ) ;
72
73
} ) ;
73
74
75
+ it ( 'should not find localeId if data is missing' , function ( ) {
76
+ expect ( findLocaleId ( '' , 'num' ) ) . toBeUndefined ( ) ;
77
+ expect ( findLocaleId ( 'aa' , 'datetime' ) ) . toBeUndefined ( ) ;
78
+ expect ( findLocaleId ( 'aa' , 'randomType' ) ) . toBeUndefined ( ) ;
79
+ expect ( findLocaleId ( 'NumberFormatSymbols_en' , 'datetime' ) ) . toBeUndefined ( ) ;
80
+ expect ( findLocaleId ( 'DateTimeSymbols_en' , 'num' ) ) . toBeUndefined ( ) ;
81
+ } ) ;
74
82
75
- it ( " should throw an error otherwise" , function ( ) {
83
+ it ( ' should throw an error otherwise' , function ( ) {
76
84
expect ( function ( ) {
77
- findLocaleId ( " str" , " otherwise" ) ;
78
- } ) . toThrowError ( " unknown type in findLocaleId: otherwise" ) ;
85
+ findLocaleId ( ' str' , ' otherwise' ) ;
86
+ } ) . toThrowError ( ' unknown type in findLocaleId: otherwise' ) ;
79
87
} ) ;
80
88
} ) ;
81
89
0 commit comments