From a7a6c83c6065abde52664340b8adc33bfa863706 Mon Sep 17 00:00:00 2001 From: Lucas <100660343+lulunac27a@users.noreply.github.com> Date: Fri, 22 Mar 2024 21:15:07 -0500 Subject: [PATCH 1/4] Make VIN number generation more accurate The last six digits of VIN (vehicle identification number) is the number and the 13th digit (last five digits) can start with number 0 (zero). --- src/modules/vehicle/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/vehicle/index.ts b/src/modules/vehicle/index.ts index e47b7b05765..2cae096105e 100644 --- a/src/modules/vehicle/index.ts +++ b/src/modules/vehicle/index.ts @@ -96,7 +96,7 @@ export class VehicleModule extends ModuleBase { length: 1, casing: 'upper', exclude, - })}${this.faker.number.int({ min: 10000, max: 99999 })}`; // return five digit # + })}${this.faker.number.int({ min: 0, max: 99999 }).toString().padStart(5, '0'}`; // return five digit # with leading zeros } /** From 3ecf4abfd00c0dfc02b6efbf3189efd81d4c7861 Mon Sep 17 00:00:00 2001 From: Lucas <100660343+lulunac27a@users.noreply.github.com> Date: Sat, 23 Mar 2024 07:54:57 -0500 Subject: [PATCH 2/4] Fix error Fix code mistake --- src/modules/vehicle/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/vehicle/index.ts b/src/modules/vehicle/index.ts index 2cae096105e..1ea0e0e20f3 100644 --- a/src/modules/vehicle/index.ts +++ b/src/modules/vehicle/index.ts @@ -96,7 +96,7 @@ export class VehicleModule extends ModuleBase { length: 1, casing: 'upper', exclude, - })}${this.faker.number.int({ min: 0, max: 99999 }).toString().padStart(5, '0'}`; // return five digit # with leading zeros + })}${this.faker.number.int({ min: 0, max: 99999 }).toString().padStart(5, '0')}`; // return five digit # with leading zeros } /** From f692c0ba84a559f25aa93029fde591ddb4a7a98a Mon Sep 17 00:00:00 2001 From: xDivisionByZerox Date: Thu, 25 Apr 2024 20:25:56 +0200 Subject: [PATCH 3/4] test: update snapshots --- test/modules/__snapshots__/vehicle.spec.ts.snap | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/modules/__snapshots__/vehicle.spec.ts.snap b/test/modules/__snapshots__/vehicle.spec.ts.snap index 9655105db1e..0af494b4eee 100644 --- a/test/modules/__snapshots__/vehicle.spec.ts.snap +++ b/test/modules/__snapshots__/vehicle.spec.ts.snap @@ -14,7 +14,7 @@ exports[`vehicle > 42 > type 1`] = `"Extended Cab Pickup"`; exports[`vehicle > 42 > vehicle 1`] = `"Ford V90"`; -exports[`vehicle > 42 > vin 1`] = `"CYRK551VKPAZ84919"`; +exports[`vehicle > 42 > vin 1`] = `"CYRK551VKPAZ83244"`; exports[`vehicle > 42 > vrm 1`] = `"JY75EEB"`; @@ -32,7 +32,7 @@ exports[`vehicle > 1211 > type 1`] = `"Wagon"`; exports[`vehicle > 1211 > vehicle 1`] = `"Toyota Aventador"`; -exports[`vehicle > 1211 > vin 1`] = `"XW7ZNNSBNTUM84790"`; +exports[`vehicle > 1211 > vin 1`] = `"XW7ZNNSBNTUM83100"`; exports[`vehicle > 1211 > vrm 1`] = `"YX29RRT"`; @@ -50,6 +50,6 @@ exports[`vehicle > 1337 > type 1`] = `"Coupe"`; exports[`vehicle > 1337 > vehicle 1`] = `"Dodge Volt"`; -exports[`vehicle > 1337 > vin 1`] = `"859FAH8ZR3JL21255"`; +exports[`vehicle > 1337 > vin 1`] = `"859FAH8ZR3JL12505"`; exports[`vehicle > 1337 > vrm 1`] = `"GE24ING"`; From 30a7d80067beade885f9f4aeb165718266d15745 Mon Sep 17 00:00:00 2001 From: xDivisionByZerox Date: Thu, 25 Apr 2024 22:42:25 +0200 Subject: [PATCH 4/4] refactor: apply suggestions --- src/modules/vehicle/index.ts | 2 +- test/modules/__snapshots__/vehicle.spec.ts.snap | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/vehicle/index.ts b/src/modules/vehicle/index.ts index 1ea0e0e20f3..d032465a42d 100644 --- a/src/modules/vehicle/index.ts +++ b/src/modules/vehicle/index.ts @@ -96,7 +96,7 @@ export class VehicleModule extends ModuleBase { length: 1, casing: 'upper', exclude, - })}${this.faker.number.int({ min: 0, max: 99999 }).toString().padStart(5, '0')}`; // return five digit # with leading zeros + })}${this.faker.string.numeric({ length: 5, allowLeadingZeros: true })}`; } /** diff --git a/test/modules/__snapshots__/vehicle.spec.ts.snap b/test/modules/__snapshots__/vehicle.spec.ts.snap index 0af494b4eee..bfe730e197d 100644 --- a/test/modules/__snapshots__/vehicle.spec.ts.snap +++ b/test/modules/__snapshots__/vehicle.spec.ts.snap @@ -14,7 +14,7 @@ exports[`vehicle > 42 > type 1`] = `"Extended Cab Pickup"`; exports[`vehicle > 42 > vehicle 1`] = `"Ford V90"`; -exports[`vehicle > 42 > vin 1`] = `"CYRK551VKPAZ83244"`; +exports[`vehicle > 42 > vin 1`] = `"CYRK551VKPAZ82113"`; exports[`vehicle > 42 > vrm 1`] = `"JY75EEB"`; @@ -32,7 +32,7 @@ exports[`vehicle > 1211 > type 1`] = `"Wagon"`; exports[`vehicle > 1211 > vehicle 1`] = `"Toyota Aventador"`; -exports[`vehicle > 1211 > vin 1`] = `"XW7ZNNSBNTUM83100"`; +exports[`vehicle > 1211 > vin 1`] = `"XW7ZNNSBNTUM84882"`; exports[`vehicle > 1211 > vrm 1`] = `"YX29RRT"`; @@ -50,6 +50,6 @@ exports[`vehicle > 1337 > type 1`] = `"Coupe"`; exports[`vehicle > 1337 > vehicle 1`] = `"Dodge Volt"`; -exports[`vehicle > 1337 > vin 1`] = `"859FAH8ZR3JL12505"`; +exports[`vehicle > 1337 > vin 1`] = `"859FAH8ZR3JL19477"`; exports[`vehicle > 1337 > vrm 1`] = `"GE24ING"`;