@@ -17,34 +17,34 @@ describe('best conversions', () => {
17
17
expect ( result . unit ) . toBe ( 'd' ) ;
18
18
19
19
expect ( result . quantity ) . toMatchInlineSnapshot ( '1.5' ) ;
20
- expect ( result . toString ( ) ) . toMatchInlineSnapshot ( `"1.5d "` ) ;
20
+ expect ( result . toString ( ) ) . toMatchInlineSnapshot ( `"1.5 d "` ) ;
21
21
} ) ;
22
22
23
23
describe ( 'with rounding' , ( ) => {
24
24
test ( 'works when removing decimal places' , ( ) => {
25
- expect ( convert ( 123_456 , 'm' ) . to ( 'best' ) . toString ( 2 ) ) . toMatchInlineSnapshot ( `"123.46km "` ) ;
26
- expect ( convert ( 123_456 , 'm' ) . to ( 'best' ) . toString ( 0 ) ) . toMatchInlineSnapshot ( `"123km "` ) ;
27
- expect ( convert ( 1000 , 'micrometer' ) . to ( 'best' ) . toString ( 1 ) ) . toMatchInlineSnapshot ( `"1.0mm "` ) ;
28
- expect ( convert ( 1000 , 'micrometer' ) . to ( 'best' ) . toString ( 0 ) ) . toMatchInlineSnapshot ( `"1mm "` ) ;
25
+ expect ( convert ( 123_456 , 'm' ) . to ( 'best' ) . toString ( 2 ) ) . toMatchInlineSnapshot ( `"123.46 km "` ) ;
26
+ expect ( convert ( 123_456 , 'm' ) . to ( 'best' ) . toString ( 0 ) ) . toMatchInlineSnapshot ( `"123 km "` ) ;
27
+ expect ( convert ( 1000 , 'micrometer' ) . to ( 'best' ) . toString ( 1 ) ) . toMatchInlineSnapshot ( `"1.0 mm "` ) ;
28
+ expect ( convert ( 1000 , 'micrometer' ) . to ( 'best' ) . toString ( 0 ) ) . toMatchInlineSnapshot ( `"1 mm "` ) ;
29
29
} ) ;
30
30
31
31
test ( 'works when adding decimal places' , ( ) => {
32
- expect ( convert ( 1000 , 'm' ) . to ( 'best' ) . toString ( 4 ) ) . toMatchInlineSnapshot ( `"1.0000km "` ) ;
33
- expect ( convert ( 1000 , 'm' ) . to ( 'best' ) . toString ( 0 ) ) . toMatchInlineSnapshot ( `"1km "` ) ;
34
- expect ( convert ( 1000 , 'micrometer' ) . to ( 'best' ) . toString ( 4 ) ) . toMatchInlineSnapshot ( `"1.0000mm "` ) ;
35
- expect ( convert ( 1000 , 'micrometer' ) . to ( 'best' ) . toString ( 0 ) ) . toMatchInlineSnapshot ( `"1mm "` ) ;
32
+ expect ( convert ( 1000 , 'm' ) . to ( 'best' ) . toString ( 4 ) ) . toMatchInlineSnapshot ( `"1.0000 km "` ) ;
33
+ expect ( convert ( 1000 , 'm' ) . to ( 'best' ) . toString ( 0 ) ) . toMatchInlineSnapshot ( `"1 km "` ) ;
34
+ expect ( convert ( 1000 , 'micrometer' ) . to ( 'best' ) . toString ( 4 ) ) . toMatchInlineSnapshot ( `"1.0000 mm "` ) ;
35
+ expect ( convert ( 1000 , 'micrometer' ) . to ( 'best' ) . toString ( 0 ) ) . toMatchInlineSnapshot ( `"1 mm "` ) ;
36
36
} ) ;
37
37
38
38
test ( 'does nothing when omitted' , ( ) => {
39
- expect ( convert ( 123_456 , 'm' ) . to ( 'best' ) . toString ( ) ) . toMatchInlineSnapshot ( `"123.456km "` ) ;
40
- expect ( convert ( 123_456 , 'm' ) . to ( 'best' ) . toString ( undefined ) ) . toMatchInlineSnapshot ( `"123.456km "` ) ;
41
- expect ( convert ( 1000 , 'micrometer' ) . to ( 'best' ) . toString ( ) ) . toMatchInlineSnapshot ( `"1mm "` ) ;
42
- expect ( convert ( 1000 , 'micrometer' ) . to ( 'best' ) . toString ( undefined ) ) . toMatchInlineSnapshot ( `"1mm "` ) ;
39
+ expect ( convert ( 123_456 , 'm' ) . to ( 'best' ) . toString ( ) ) . toMatchInlineSnapshot ( `"123.456 km "` ) ;
40
+ expect ( convert ( 123_456 , 'm' ) . to ( 'best' ) . toString ( undefined ) ) . toMatchInlineSnapshot ( `"123.456 km "` ) ;
41
+ expect ( convert ( 1000 , 'micrometer' ) . to ( 'best' ) . toString ( ) ) . toMatchInlineSnapshot ( `"1 mm "` ) ;
42
+ expect ( convert ( 1000 , 'micrometer' ) . to ( 'best' ) . toString ( undefined ) ) . toMatchInlineSnapshot ( `"1 mm "` ) ;
43
43
} ) ;
44
44
} ) ;
45
45
46
46
test ( 'works with metric' , ( ) => {
47
- expect ( convert ( 0.001 , 'days' ) . to ( 'best' , 'metric' ) . toString ( ) ) . toMatchInlineSnapshot ( `"1.44min "` ) ;
47
+ expect ( convert ( 0.001 , 'days' ) . to ( 'best' , 'metric' ) . toString ( ) ) . toMatchInlineSnapshot ( `"1.44 min "` ) ;
48
48
} ) ;
49
49
} ) ;
50
50
0 commit comments