@@ -122,65 +122,33 @@ describe("string tests", () => {
122122 } ) ;
123123
124124 test . each ( [
125- [ null as unknown as string , " " , null ] ,
126- [ undefined as unknown as string , " " , undefined ] ,
125+ [ "" , " " , "" ] ,
126+ [ "" , "" , "" ] ,
127+ [ "hello world" , "" , "hello world" ] ,
127128 [ " hello world" , " " , "hello world" ] ,
128- [ " hello world" , " " , "hello world" ] ,
129- [ " hello world" , " " , "hello world" ] ,
130129 ] ) ( "left trim" , ( haystack , needle , expected ) => {
131130 expect ( ltrim ( haystack , needle ) ) . toBe ( expected ) ;
132131 } ) ;
133132
134133 test . each ( [
135- [ null as unknown as string , " " , null ] ,
136- [ undefined as unknown as string , " " , undefined ] ,
137- [ " hello world" , "" , " hello world" ] ,
138- [ " hello world" , "" , " hello world" ] ,
139- [ " hello world" , "" , " hello world" ] ,
140- ] ) ( "left trim without needle" , ( haystack , needle , expected ) => {
141- expect ( ltrim ( haystack , needle ) ) . toBe ( expected ) ;
142- } ) ;
143-
144- test . each ( [
145- [ null as unknown as string , " " , null ] ,
146- [ undefined as unknown as string , " " , undefined ] ,
134+ [ "" , " " , "" ] ,
135+ [ "" , "" , "" ] ,
136+ [ "hello world" , "hello world" , "" ] ,
137+ [ "hello world" , "" , "hello world" ] ,
147138 [ "hello world " , " " , "hello world" ] ,
148- [ "hello world " , " " , "hello world" ] ,
149- [ "hello world " , " " , "hello world" ] ,
150139 ] ) ( "right trim" , ( haystack , needle , expected ) => {
151140 expect ( rtrim ( haystack , needle ) ) . toBe ( expected ) ;
152141 } ) ;
153142
154143 test . each ( [
155- [ null as unknown as string , " " , null ] ,
156- [ undefined as unknown as string , " " , undefined ] ,
157- [ "hello world " , "" , "hello world " ] ,
158- [ "hello world " , "" , "hello world " ] ,
159- [ "hello world " , "" , "hello world " ] ,
160- ] ) ( "right trim without needle" , ( haystack , needle , expected ) => {
161- expect ( rtrim ( haystack , needle ) ) . toBe ( expected ) ;
162- } ) ;
163-
164- test . each ( [
165- [ null as unknown as string , " " , null ] ,
166- [ undefined as unknown as string , " " , undefined ] ,
144+ [ "" , " " , "" ] ,
145+ [ "" , "" , "" ] ,
146+ [ "hello world" , "" , "hello world" ] ,
167147 [ " hello world " , " " , "hello world" ] ,
168- [ " hello world " , " " , "hello world" ] ,
169- [ " hello world " , " " , "hello world" ] ,
170148 ] ) ( "trim" , ( haystack , needle , expected ) => {
171149 expect ( trim ( haystack , needle ) ) . toBe ( expected ) ;
172150 } ) ;
173151
174- test . each ( [
175- [ null as unknown as string , " " , null ] ,
176- [ undefined as unknown as string , " " , undefined ] ,
177- [ " hello world " , "" , " hello world " ] ,
178- [ " hello world " , "" , " hello world " ] ,
179- [ " hello world " , "" , " hello world " ] ,
180- ] ) ( "trim without needle" , ( haystack , needle , expected ) => {
181- expect ( trim ( haystack , needle ) ) . toBe ( expected ) ;
182- } ) ;
183-
184152 test . each ( [ [ "hello world" , [ "hello world" ] ] ] ) ( "splitLine with single line" , ( str , expected ) => {
185153 expect ( splitLine ( str ) ) . toStrictEqual ( expected ) ;
186154 } ) ;
0 commit comments