1- import { isNullOrEmpty , isNullOrWhitespace , capitalize , uncapitalize , truncate , ltrim , rtrim , trim } from "./string" ;
1+ import { isNullOrEmpty , isNullOrWhitespace , capitalize , uncapitalize , truncate , trimStart , trimEnd , trim } from "./string" ;
22
33describe ( "string tests" , ( ) => {
44 test . each ( [
@@ -128,7 +128,7 @@ describe("string tests", () => {
128128 [ "hello world" , " " , "hello world" ] ,
129129 [ " hello world" , " " , "hello world" ] ,
130130 ] ) ( "left trim" , ( haystack , needle , expected ) => {
131- expect ( ltrim ( haystack , needle ) ) . toBe ( expected ) ;
131+ expect ( trimStart ( haystack , needle ) ) . toBe ( expected ) ;
132132 } ) ;
133133
134134 test . each ( [
@@ -138,14 +138,17 @@ describe("string tests", () => {
138138 [ "hello world " , " " , "hello world" ] ,
139139 [ "hello world" , " " , "hello world" ] ,
140140 ] ) ( "right trim" , ( haystack , needle , expected ) => {
141- expect ( rtrim ( haystack , needle ) ) . toBe ( expected ) ;
141+ expect ( trimEnd ( haystack , needle ) ) . toBe ( expected ) ;
142142 } ) ;
143143
144144 test . each ( [
145145 [ null as unknown as string , " " , null as unknown as string ] ,
146146 [ undefined as unknown as string , " " , undefined as unknown as string ] ,
147147 [ "hello world" , "" , "hello world" ] ,
148148 [ " hello world " , " " , "hello world" ] ,
149+ [ "hello world " , " " , "hello world" ] ,
150+ [ " hello world" , " " , "hello world" ] ,
151+ [ "hello worldhello world" , "hello world" , "" ] ,
149152 ] ) ( "trim" , ( haystack , needle , expected ) => {
150153 expect ( trim ( haystack , needle ) ) . toBe ( expected ) ;
151154 } ) ;
0 commit comments