@@ -114,6 +114,55 @@ describe("StringUtils", () => {
114114
115115 // #endregion isValidEmail
116116
117+ // -----------------------------------------------------------------------------------------
118+ // #region join()
119+ // -----------------------------------------------------------------------------------------
120+
121+ describe ( "join()" , ( ) => {
122+ describe ( "with the default separator" , ( ) => {
123+ type JoinTestTypes = [ string [ ] , string ] ;
124+
125+ test . each < JoinTestTypes > ( [
126+ [ [ ] , "" ] ,
127+ [ [ "a" ] , "a" ] ,
128+ [ [ "a" ] , "a" ] ,
129+ [ [ "a" , "b" ] , "a,b" ] ,
130+ ] ) (
131+ "when values is %p, returns %p" ,
132+ ( values : string [ ] , expected : string ) => {
133+ // Arrange & Act
134+ const result : string = StringUtils . join ( values ) ;
135+
136+ // Assert
137+ expect ( result ) . toBe ( expected ) ;
138+ }
139+ ) ;
140+ } ) ;
141+
142+ describe ( "with a separator argument" , ( ) => {
143+ type JoinTestTypesWithSeparator = [ string [ ] , string , string ] ;
144+
145+ test . each < JoinTestTypesWithSeparator > ( [
146+ [ [ ] , "" , "" ] ,
147+ [ [ "a" ] , "" , "a" ] ,
148+ [ [ "a" ] , "," , "a" ] ,
149+ [ [ "a" , "b" ] , "" , "ab" ] ,
150+ [ [ "a" , "b" ] , " " , "a b" ] ,
151+ ] ) (
152+ "when values is %p and separator is %p, returns %p" ,
153+ ( values : string [ ] , separator : string , expected : string ) => {
154+ // Arrange & Act
155+ const result : string = StringUtils . join ( values , separator ) ;
156+
157+ // Assert
158+ expect ( result ) . toBe ( expected ) ;
159+ }
160+ ) ;
161+ } ) ;
162+ } ) ;
163+
164+ // #endregion join
165+
117166 // -----------------------------------------------------------------------------------------
118167 // #region truncateRight()
119168 // -----------------------------------------------------------------------------------------
0 commit comments