@@ -146,5 +146,59 @@ suite("Extension Test Suite", () => {
146
146
assert . equal ( func ( originalString , multiselectData ) , expectedString ) ;
147
147
} ) ;
148
148
} ) ;
149
+
150
+ suite ( "randomCase" , ( ) => {
151
+ const input = "Hello, World!" ;
152
+
153
+ test ( "returns a string of the same length" , ( ) => {
154
+ const output = myExtension . commandNameFunctionMap [ "randomCase" ] (
155
+ input
156
+ ) as string ;
157
+ assert . equal ( output . length , input . length ) ;
158
+ } ) ;
159
+
160
+ test ( "contains the same characters ignoring case" , ( ) => {
161
+ const output = myExtension . commandNameFunctionMap [ "randomCase" ] (
162
+ input
163
+ ) as string ;
164
+ assert . equal ( output . toLowerCase ( ) , input . toLowerCase ( ) ) ;
165
+ } ) ;
166
+
167
+ test ( "changes the case of at least one character (statistically)" , ( ) => {
168
+ let changed = false ;
169
+ for ( let i = 0 ; i < 10 ; i ++ ) {
170
+ const output = myExtension . commandNameFunctionMap [ "randomCase" ] (
171
+ input
172
+ ) as string ;
173
+ if ( output !== input && output . toLowerCase ( ) === input . toLowerCase ( ) ) {
174
+ changed = true ;
175
+ break ;
176
+ }
177
+ }
178
+ assert . equal ( changed , true ) ;
179
+ } ) ;
180
+
181
+ test ( "handles empty strings" , ( ) => {
182
+ const output = myExtension . commandNameFunctionMap . randomCase ( "" ) ;
183
+ assert . equal ( output , "" ) ;
184
+ } ) ;
185
+
186
+ test ( "preserves non-alphabetic characters" , ( ) => {
187
+ const specialChars = "12345!@#$%" ;
188
+ const output =
189
+ myExtension . commandNameFunctionMap . randomCase ( specialChars ) ;
190
+ assert . equal ( output , specialChars ) ;
191
+ } ) ;
192
+
193
+ test ( "handles strings with mixed content" , ( ) => {
194
+ const mixedInput = "Test123!" ;
195
+ const output = myExtension . commandNameFunctionMap . randomCase (
196
+ mixedInput
197
+ ) as string ;
198
+ assert . equal ( output . length , mixedInput . length ) ;
199
+ assert . notEqual ( output . replace ( / [ ^ a - z A - Z ] / g, "" ) , "" ) ;
200
+ } ) ;
201
+
202
+ } ) ;
149
203
} ) ;
150
204
} ) ;
0 commit comments