File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ export class Vehicle {
87
87
bannedChars,
88
88
} ) } ${ this . faker . random . alphaNumeric ( 1 , {
89
89
bannedChars,
90
- } ) } ${ this . faker . datatype . number ( { min : 10000 , max : 100000 } ) } ` // return five digit #
90
+ } ) } ${ this . faker . datatype . number ( { min : 10000 , max : 99999 } ) } ` // return five digit #
91
91
. toUpperCase ( ) ;
92
92
}
93
93
Original file line number Diff line number Diff line change @@ -106,6 +106,24 @@ describe('vehicle', () => {
106
106
) ;
107
107
} ) ;
108
108
} ) ;
109
+
110
+ describe ( 'vin()' , ( ) => {
111
+ it ( 'returns valid vin number' , ( ) => {
112
+ const vin = faker . vehicle . vin ( ) ;
113
+ expect ( vin ) . match (
114
+ / ^ ( [ A - H J - N P R - Z 0 - 9 ] { 10 } [ A - H J - N P R - Z 0 - 9 ] { 1 } [ A - H J - N P R - Z 0 - 9 ] { 1 } \d { 5 } ) $ /
115
+ ) ;
116
+ } ) ;
117
+
118
+ it ( 'is 17 characters long' , ( ) => {
119
+ for ( let step = 0 ; step < 300000 ; step ++ ) {
120
+ const vin = faker . vehicle . vin ( ) ;
121
+ expect ( vin ) . match (
122
+ / ^ ( [ A - H J - N P R - Z 0 - 9 ] { 10 } [ A - H J - N P R - Z 0 - 9 ] { 1 } [ A - H J - N P R - Z 0 - 9 ] { 1 } \d { 5 } ) $ /
123
+ ) ;
124
+ }
125
+ } ) ;
126
+ } ) ;
109
127
110
128
describe ( 'model()' , ( ) => {
111
129
it ( 'should return random vehicle model' , ( ) => {
You can’t perform that action at this time.
0 commit comments