@@ -5,26 +5,27 @@ describe('humanFileSize', () => {
55 it ( 'should return bytes for values less than 1024' , ( ) => {
66 expect ( humanFileSize ( 500 ) ) . toBe ( '500 B' ) ;
77 expect ( humanFileSize ( 0 ) ) . toBe ( '0 B' ) ;
8- expect ( humanFileSize ( 1023 ) ) . toBe ( '1023 B' ) ;
8+ expect ( humanFileSize ( 1023 ) ) . toBe ( '1,023 B' ) ;
99 } ) ;
1010
11- it ( 'should convert to KB for values between 1024 and 1048575' , ( ) => {
12- expect ( humanFileSize ( 1024 ) ) . toBe ( '1 KB' ) ;
13- expect ( humanFileSize ( 2048 ) ) . toBe ( '2 KB' ) ;
14- expect ( humanFileSize ( 1000000 ) ) . toBe ( '977 KB' ) ;
11+ it ( 'should convert to KiB for values between 1024 and 1048575' , ( ) => {
12+ expect ( humanFileSize ( 1024 ) ) . toBe ( '1 KiB' ) ;
13+ expect ( humanFileSize ( 2048 ) ) . toBe ( '2 KiB' ) ;
14+ expect ( humanFileSize ( 1000000 ) ) . toBe ( '977 KiB' ) ;
15+ expect ( humanFileSize ( 1023900 ) ) . toBe ( '1,000 KiB' )
1516 } ) ;
1617
17- it ( 'should convert to MB for appropriate values' , ( ) => {
18- expect ( humanFileSize ( 1048576 ) ) . toBe ( '1 MB ' ) ;
19- expect ( humanFileSize ( 2097152 ) ) . toBe ( '2 MB ' ) ;
18+ it ( 'should convert to MiB for appropriate values' , ( ) => {
19+ expect ( humanFileSize ( 1048576 ) ) . toBe ( '1 MiB ' ) ;
20+ expect ( humanFileSize ( 2097152 ) ) . toBe ( '2 MiB ' ) ;
2021 } ) ;
2122
22- it ( 'should convert to GB for appropriate values' , ( ) => {
23- expect ( humanFileSize ( 1073741824 ) ) . toBe ( '1 GB ' ) ;
23+ it ( 'should convert to GiB for appropriate values' , ( ) => {
24+ expect ( humanFileSize ( 1073741824 ) ) . toBe ( '1 GiB ' ) ;
2425 } ) ;
2526
2627 it ( 'should apply the multiplier correctly' , ( ) => {
27- expect ( humanFileSize ( 2 , 1024 ) ) . toBe ( '2 KB ' ) ;
28- expect ( humanFileSize ( 2 , 1048576 ) ) . toBe ( '2 MB ' ) ;
28+ expect ( humanFileSize ( 2 , 1024 ) ) . toBe ( '2 KiB ' ) ;
29+ expect ( humanFileSize ( 2 , 1048576 ) ) . toBe ( '2 MiB ' ) ;
2930 } ) ;
3031} ) ;
0 commit comments