@@ -11,7 +11,7 @@ const functionNames: (keyof StringModule)[] = [
11
11
'hexadecimal' ,
12
12
'random' ,
13
13
'alpha' ,
14
- 'alphaNumeric ' ,
14
+ 'alphanumeric ' ,
15
15
'numeric' ,
16
16
] ;
17
17
@@ -212,7 +212,7 @@ describe('string', () => {
212
212
213
213
describe ( 'alphaNumeric' , ( ) => {
214
214
it ( 'should generate single character when no additional argument was provided' , ( ) => {
215
- const actual = faker . string . alphaNumeric ( ) ;
215
+ const actual = faker . string . alphanumeric ( ) ;
216
216
217
217
expect ( actual ) . toHaveLength ( 1 ) ;
218
218
} ) ;
@@ -222,28 +222,28 @@ describe('string', () => {
222
222
[ 'lower' , / ^ [ a - z 0 - 9 ] { 250 } $ / ] ,
223
223
[ 'mixed' , / ^ [ a - z A - Z 0 - 9 ] { 250 } $ / ] ,
224
224
] as const ) ( 'should return %s-case' , ( casing , pattern ) => {
225
- const actual = faker . string . alphaNumeric ( { count : 250 , casing } ) ;
225
+ const actual = faker . string . alphanumeric ( { count : 250 , casing } ) ;
226
226
expect ( actual ) . toMatch ( pattern ) ;
227
227
} ) ;
228
228
229
229
it ( 'should generate many random characters' , ( ) => {
230
- const actual = faker . string . alphaNumeric ( 5 ) ;
230
+ const actual = faker . string . alphanumeric ( 5 ) ;
231
231
232
232
expect ( actual ) . toHaveLength ( 5 ) ;
233
233
} ) ;
234
234
235
235
it . each ( [ 0 , - 1 , - 100 ] ) (
236
236
'should return empty string when length is <= 0' ,
237
237
( length ) => {
238
- const actual = faker . string . alphaNumeric ( length ) ;
238
+ const actual = faker . string . alphanumeric ( length ) ;
239
239
240
240
expect ( actual ) . toBe ( '' ) ;
241
241
}
242
242
) ;
243
243
244
244
it ( 'should be able to ban all alphabetic characters' , ( ) => {
245
245
const bannedChars = 'abcdefghijklmnopqrstuvwxyz' . split ( '' ) ;
246
- const alphaText = faker . string . alphaNumeric ( {
246
+ const alphaText = faker . string . alphanumeric ( {
247
247
count : 5 ,
248
248
bannedChars,
249
249
casing : 'lower' ,
@@ -257,7 +257,7 @@ describe('string', () => {
257
257
258
258
it ( 'should be able to ban all alphabetic characters via string' , ( ) => {
259
259
const bannedChars = 'abcdefghijklmnopqrstuvwxyz' ;
260
- const alphaText = faker . string . alphaNumeric ( {
260
+ const alphaText = faker . string . alphanumeric ( {
261
261
count : 5 ,
262
262
bannedChars,
263
263
casing : 'lower' ,
@@ -271,7 +271,7 @@ describe('string', () => {
271
271
272
272
it ( 'should be able to ban all numeric characters' , ( ) => {
273
273
const bannedChars = '0123456789' . split ( '' ) ;
274
- const alphaText = faker . string . alphaNumeric ( {
274
+ const alphaText = faker . string . alphanumeric ( {
275
275
count : 5 ,
276
276
bannedChars,
277
277
} ) ;
@@ -284,7 +284,7 @@ describe('string', () => {
284
284
285
285
it ( 'should be able to ban all numeric characters via string' , ( ) => {
286
286
const bannedChars = '0123456789' ;
287
- const alphaText = faker . string . alphaNumeric ( {
287
+ const alphaText = faker . string . alphanumeric ( {
288
288
count : 5 ,
289
289
bannedChars,
290
290
} ) ;
@@ -296,7 +296,7 @@ describe('string', () => {
296
296
} ) ;
297
297
298
298
it ( 'should be able to handle mistake in banned characters array' , ( ) => {
299
- const alphaText = faker . string . alphaNumeric ( {
299
+ const alphaText = faker . string . alphanumeric ( {
300
300
count : 5 ,
301
301
bannedChars : [ 'a' , 'p' , 'a' ] ,
302
302
casing : 'lower' ,
@@ -309,7 +309,7 @@ describe('string', () => {
309
309
it ( 'should throw if all possible characters being banned' , ( ) => {
310
310
const bannedChars = 'abcdefghijklmnopqrstuvwxyz0123456789' . split ( '' ) ;
311
311
expect ( ( ) =>
312
- faker . string . alphaNumeric ( {
312
+ faker . string . alphanumeric ( {
313
313
count : 5 ,
314
314
bannedChars,
315
315
casing : 'lower' ,
@@ -324,7 +324,7 @@ describe('string', () => {
324
324
it ( 'should throw if all possible characters being banned via string' , ( ) => {
325
325
const bannedChars = 'abcdefghijklmnopqrstuvwxyz0123456789' ;
326
326
expect ( ( ) =>
327
- faker . string . alphaNumeric ( {
327
+ faker . string . alphanumeric ( {
328
328
count : 5 ,
329
329
bannedChars,
330
330
casing : 'lower' ,
@@ -341,7 +341,7 @@ describe('string', () => {
341
341
count : 5 ,
342
342
} ) ;
343
343
344
- expect ( ( ) => faker . string . alphaNumeric ( input ) ) . not . toThrow ( ) ;
344
+ expect ( ( ) => faker . string . alphanumeric ( input ) ) . not . toThrow ( ) ;
345
345
expect ( input . bannedChars ) . toEqual ( [ 'a' , '0' , '%' ] ) ;
346
346
} ) ;
347
347
} ) ;
0 commit comments