File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -396,6 +396,33 @@ describe('Helper', function () {
396396 expect ( numberWithCommas ( '0' ) ) . to . eql ( '0' ) ;
397397 expect ( numberWithCommas ( '-1234' ) ) . to . eql ( '-1,234' ) ;
398398 } ) ;
399+
400+ describe ( 'Fallback logic when Intl is not available' , function ( ) {
401+ let originalIntl : any ;
402+
403+ beforeEach ( function ( ) {
404+ // Save original Intl
405+ originalIntl = ( global as any ) . Intl ;
406+ } ) ;
407+
408+ afterEach ( function ( ) {
409+ // Restore original Intl
410+ ( global as any ) . Intl = originalIntl ;
411+ } ) ;
412+
413+ it ( 'should use fallback logic when Intl is not available' , function ( ) {
414+ // Remove Intl
415+ delete ( global as any ) . Intl ;
416+
417+ expect ( numberWithCommas ( 123 ) ) . to . eql ( '123' ) ;
418+ expect ( numberWithCommas ( 1234 ) ) . to . eql ( '1,234' ) ;
419+ expect ( numberWithCommas ( 1234567890 ) ) . to . eql ( '1,234,567,890' ) ;
420+ expect ( numberWithCommas ( 0 ) ) . to . eql ( '0' ) ;
421+ expect ( numberWithCommas ( - 1234 ) ) . to . eql ( '-1,234' ) ;
422+ expect ( numberWithCommas ( 1234.56 ) ) . to . eql ( '1,234.56' ) ;
423+ expect ( numberWithCommas ( - 1234.56 ) ) . to . eql ( '-1,234.56' ) ;
424+ } ) ;
425+ } ) ;
399426 } ) ;
400427
401428 describe ( 'prettyPrintArray()' , function ( ) {
You can’t perform that action at this time.
0 commit comments