@@ -14,10 +14,10 @@ import type { MappingRange } from '../../src/lib/types';
1414describe ( 'helpers' , ( ) => {
1515 describe ( 'formatBytes' , ( ) => {
1616 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 ' } ,
2121 ] ;
2222
2323 tests . forEach ( ( { bytes, expected } ) => {
@@ -81,43 +81,43 @@ describe('helpers', () => {
8181 position : [ number , number ] ;
8282 expected : boolean ;
8383 } [ ] = [
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+ ] ;
121121
122122 tests . forEach ( ( { name, string, position, expected } ) => {
123123 it ( name , ( ) => {
0 commit comments