From 3303c7ea863695afe8febbb312d108b03ae2c51d Mon Sep 17 00:00:00 2001 From: Tyler Date: Sun, 15 Oct 2017 13:50:41 -0700 Subject: update vin to return randomly generated vin and update tests --- lib/vehicle.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/vehicle.js b/lib/vehicle.js index 43f4248c..82b6e37f 100644 --- a/lib/vehicle.js +++ b/lib/vehicle.js @@ -83,11 +83,16 @@ var Vehicle = function (faker) { * @method faker.vehicle.vin */ self.vin = function () { - return faker.random.arrayElement(faker.definitions.vehicle.vin); + return ( + faker.random.alphaNumeric(10) + + faker.random.alpha({ count: 1, upcase: true }) + + faker.random.alphaNumeric(1) + + faker.random.number({ min: 10000, max: 100000}) // return five digit # + ).toUpperCase() }; self.vin.schema = { - "description": "Generates a VIN number.", + "description": "Generates a valid VIN number.", "sampleResults": ["YV1MH682762184654", "3C7WRMBJ2EG208836"] }; -- cgit v1.2.3