aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTyler <[email protected]>2017-10-15 13:50:41 -0700
committerTyler <[email protected]>2017-10-15 13:50:41 -0700
commit3303c7ea863695afe8febbb312d108b03ae2c51d (patch)
treefe70aa9b9dbc438e06f083641cb46c4da42c65e1 /lib
parentef6bec454298f9582ba84dcdd661001586401e60 (diff)
downloadfaker-3303c7ea863695afe8febbb312d108b03ae2c51d.tar.xz
faker-3303c7ea863695afe8febbb312d108b03ae2c51d.zip
update vin to return randomly generated vin and update tests
Diffstat (limited to 'lib')
-rw-r--r--lib/vehicle.js9
1 files changed, 7 insertions, 2 deletions
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"]
};