@@ -87,24 +87,26 @@ describe('formatNumber', () => {
8787} ) ;
8888
8989describe ( 'standard scientific formatting' , ( ) => {
90+ const value = 123 ;
91+
9092 it ( 'should apply format' , ( ) => {
91- const number = 123 ;
92- expect ( formatNumber ( number , 'e' ) ) . toEqual ( number . toExponential ( ) ) ;
93+ expect ( formatNumber ( value , 'e' ) ) . toEqual ( value . toExponential ( ) ) ;
9394 } ) ;
9495
9596 it ( 'should apply format with precision' , ( ) => {
96- const number = 123 ;
97- expect ( formatNumber ( number , 'e10' ) ) . toEqual ( number . toExponential ( 10 ) ) ;
97+ expect ( formatNumber ( value , 'e10' ) ) . toEqual ( value . toExponential ( 10 ) ) ;
9898 } ) ;
9999
100100 it ( 'should apply format when passing options object' , ( ) => {
101- const number = 123 ;
102- expect ( formatNumber ( number , { style : 'scientific' } ) ) . toEqual ( number . toExponential ( ) ) ;
101+ expect ( formatNumber ( value , { style : 'scientific' } ) ) . toEqual ( value . toExponential ( ) ) ;
103102 } ) ;
104103
105104 it ( 'should apply format with precision when passing options object' , ( ) => {
106- const number = 123 ;
107- expect ( formatNumber ( number , { style : 'scientific' , minimumFractionDigits : 10 } ) ) . toEqual ( number . toExponential ( 10 ) ) ;
105+ expect ( formatNumber ( value , { style : 'scientific' , minimumFractionDigits : 10 } ) ) . toEqual ( value . toExponential ( 10 ) ) ;
106+ } ) ;
107+
108+ it ( 'should use locale specific decimal separator' , ( ) => {
109+ expect ( formatNumber ( value , { style : 'scientific' } , 'bg' ) ) . toEqual ( '1,23e+2' ) ;
108110 } ) ;
109111} ) ;
110112
0 commit comments