@@ -14,10 +14,10 @@ import type { MappingRange } from '../../src/lib/types';
14
14
describe ( 'helpers' , ( ) => {
15
15
describe ( 'formatBytes' , ( ) => {
16
16
const tests : { bytes : number ; expected : string } [ ] = [
17
- { bytes : 0 , expected : '0 B ' } ,
18
- { bytes : 1024 , expected : '1 KB ' } ,
19
- { bytes : 27291 , expected : '26.65 KB ' } ,
20
- { bytes : 6232294 , expected : '5.94 MB ' } ,
17
+ { bytes : 0 , expected : '0B ' } ,
18
+ { bytes : 1024 , expected : '1K ' } ,
19
+ { bytes : 27291 , expected : '26.7K ' } ,
20
+ { bytes : 6232294 , expected : '5.94M ' } ,
21
21
] ;
22
22
23
23
tests . forEach ( ( { bytes, expected } ) => {
@@ -81,43 +81,43 @@ describe('helpers', () => {
81
81
position : [ number , number ] ;
82
82
expected : boolean ;
83
83
} [ ] = [
84
- {
85
- name : 'should handle CR LF' ,
86
- string : 'function calculate(a, b) {\r\n return a + b;\r\n}\r\n' ,
87
- position : [ 2 , 15 ] ,
88
- expected : true ,
89
- } ,
90
- {
91
- name : 'should handle LF' ,
92
- string : 'function calculate(a, b) {\n return a + b;\n}\n' ,
93
- position : [ 2 , 15 ] ,
94
- expected : true ,
95
- } ,
96
- {
97
- name : 'should handle string w/o EOLs' ,
98
- string : 'Math.random().toString(36).substring(2);' ,
99
- position : [ 1 , 40 ] ,
100
- expected : false ,
101
- } ,
102
- {
103
- name : 'should handle out of range line' ,
104
- string : 'const result = await process();\nconsole.log(result)' ,
105
- position : [ 3 , 10 ] ,
106
- expected : false ,
107
- } ,
108
- {
109
- name : 'should handle out of range column' ,
110
- string : 'const result = await process();\nconsole.log(result)\n' ,
111
- position : [ 2 , 23 ] ,
112
- expected : false ,
113
- } ,
114
- {
115
- name : 'should handle string with unicode' ,
116
- string : 'A 🦊 went a hunting in the 🌲.\r\nThe 🦊 wasted no ⏳ in talking.\r\n' ,
117
- position : [ 2 , 30 ] ,
118
- expected : true ,
119
- } ,
120
- ] ;
84
+ {
85
+ name : 'should handle CR LF' ,
86
+ string : 'function calculate(a, b) {\r\n return a + b;\r\n}\r\n' ,
87
+ position : [ 2 , 15 ] ,
88
+ expected : true ,
89
+ } ,
90
+ {
91
+ name : 'should handle LF' ,
92
+ string : 'function calculate(a, b) {\n return a + b;\n}\n' ,
93
+ position : [ 2 , 15 ] ,
94
+ expected : true ,
95
+ } ,
96
+ {
97
+ name : 'should handle string w/o EOLs' ,
98
+ string : 'Math.random().toString(36).substring(2);' ,
99
+ position : [ 1 , 40 ] ,
100
+ expected : false ,
101
+ } ,
102
+ {
103
+ name : 'should handle out of range line' ,
104
+ string : 'const result = await process();\nconsole.log(result)' ,
105
+ position : [ 3 , 10 ] ,
106
+ expected : false ,
107
+ } ,
108
+ {
109
+ name : 'should handle out of range column' ,
110
+ string : 'const result = await process();\nconsole.log(result)\n' ,
111
+ position : [ 2 , 23 ] ,
112
+ expected : false ,
113
+ } ,
114
+ {
115
+ name : 'should handle string with unicode' ,
116
+ string : 'A 🦊 went a hunting in the 🌲.\r\nThe 🦊 wasted no ⏳ in talking.\r\n' ,
117
+ position : [ 2 , 30 ] ,
118
+ expected : true ,
119
+ } ,
120
+ ] ;
121
121
122
122
tests . forEach ( ( { name, string, position, expected } ) => {
123
123
it ( name , ( ) => {
0 commit comments