@@ -187,12 +187,12 @@ describe('random', () => {
187
187
it ( 'should return lowercase letter when no upcase option provided' , ( ) => {
188
188
const actual = faker . random . alpha ( ) ;
189
189
190
- expect ( actual ) . match ( / [ a - z ] / ) ;
190
+ expect ( actual ) . match ( / ^ [ a - z ] $ / ) ;
191
191
} ) ;
192
192
193
193
it ( 'should return uppercase when upcase option is true' , ( ) => {
194
194
const actual = faker . random . alpha ( { upcase : true } ) ;
195
- expect ( actual ) . match ( / [ A - Z ] / ) ;
195
+ expect ( actual ) . match ( / ^ [ A - Z ] $ / ) ;
196
196
} ) ;
197
197
198
198
it ( 'should generate many random letters' , ( ) => {
@@ -208,7 +208,7 @@ describe('random', () => {
208
208
} ) ;
209
209
210
210
expect ( actual ) . toHaveLength ( 5 ) ;
211
- expect ( actual ) . match ( / [ b - o q - z ] / ) ;
211
+ expect ( actual ) . match ( / ^ [ b - o q - z ] { 5 } $ / ) ;
212
212
} ) ;
213
213
214
214
it ( 'should be able handle mistake in banned characters array' , ( ) => {
@@ -218,7 +218,7 @@ describe('random', () => {
218
218
} ) ;
219
219
220
220
expect ( alphaText ) . toHaveLength ( 5 ) ;
221
- expect ( alphaText ) . match ( / [ b - o q - z ] / ) ;
221
+ expect ( alphaText ) . match ( / ^ [ b - o q - z ] { 5 } $ / ) ;
222
222
} ) ;
223
223
} ) ;
224
224
@@ -265,7 +265,7 @@ describe('random', () => {
265
265
} ) ;
266
266
267
267
expect ( alphaText ) . toHaveLength ( 5 ) ;
268
- expect ( alphaText ) . match ( / [ b - o q - z ] / ) ;
268
+ expect ( alphaText ) . match ( / ^ [ 0 - 9 b - o q - z ] { 5 } $ / ) ;
269
269
} ) ;
270
270
271
271
it ( 'should throw if all possible characters being banned' , ( ) => {
0 commit comments