diff --git a/src/vehicle.ts b/src/vehicle.ts index e2678bee4d4..979631bdddc 100644 --- a/src/vehicle.ts +++ b/src/vehicle.ts @@ -82,7 +82,7 @@ export class Vehicle { bannedChars, })}${this.faker.random.alphaNumeric(1, { bannedChars, - })}${this.faker.datatype.number({ min: 10000, max: 100000 })}` // return five digit # + })}${this.faker.datatype.number({ min: 10000, max: 99999 })}` // return five digit # .toUpperCase(); } diff --git a/test/vehicle.spec.ts b/test/vehicle.spec.ts index b52ccff6b74..28757e6b03a 100644 --- a/test/vehicle.spec.ts +++ b/test/vehicle.spec.ts @@ -24,7 +24,7 @@ const seededRuns = [ model: 'Colorado', type: 'Coupe', fuel: 'Electric', - vin: '8J579HF1A7MK33575', + vin: '8J579HF1A7MK33574', color: 'black', vrm: 'GO12HOL', bicycle: 'Cyclocross Bicycle', @@ -38,7 +38,7 @@ const seededRuns = [ model: '2', type: 'Wagon', fuel: 'Hybrid', - vin: 'XFWS74Z1N5S678768', + vin: 'XFWS74Z1N5S678767', color: 'azure', vrm: 'YL87FDZ', bicycle: 'Triathlon/Time Trial Bicycle', @@ -107,6 +107,15 @@ describe('vehicle', () => { }); }); + describe('vin()', () => { + it('returns valid vin number', () => { + const vin = faker.vehicle.vin(); + expect(vin).toMatch( + /^([A-HJ-NPR-Z0-9]{10}[A-HJ-NPR-Z0-9]{1}[A-HJ-NPR-Z0-9]{1}\d{5})$/ + ); + }); + }); + describe('model()', () => { it('should return random vehicle model', () => { const model = faker.vehicle.model();