diff options
| author | Jason Hong <[email protected]> | 2021-03-07 12:46:58 -0800 |
|---|---|---|
| committer | Jason Hong <[email protected]> | 2021-03-07 12:46:58 -0800 |
| commit | 8af8242af098e970e684cc702dc3345c802f6b19 (patch) | |
| tree | 744a06d418ad55cc7aa825bc847535fd2d7bfc0d | |
| parent | da636fe11e99f807d6dabe3c7e813f0a66a2aa9f (diff) | |
| download | faker-8af8242af098e970e684cc702dc3345c802f6b19.tar.xz faker-8af8242af098e970e684cc702dc3345c802f6b19.zip | |
add bicycleType in the vehicle module
| -rw-r--r-- | lib/locales/en/vehicle/bicycle_type.js | 20 | ||||
| -rw-r--r-- | lib/locales/en/vehicle/index.js | 1 | ||||
| -rw-r--r-- | lib/vehicle.js | 14 | ||||
| -rw-r--r-- | test/vehicle.unit.js | 10 |
4 files changed, 45 insertions, 0 deletions
diff --git a/lib/locales/en/vehicle/bicycle_type.js b/lib/locales/en/vehicle/bicycle_type.js new file mode 100644 index 00000000..519e3525 --- /dev/null +++ b/lib/locales/en/vehicle/bicycle_type.js @@ -0,0 +1,20 @@ +module["exports"] = [ + "Adventure Road Bicycle", + "BMX Bicycle", + "City Bicycle", + "Cruiser Bicycle", + "Cyclocross Bicycle", + "Dual-Sport Bicycle", + "Fitness Bicycle", + "Flat-Foot Comfort Bicycle", + "Folding Bicycle", + "Hybrid Bicycle", + "Mountain Bicycle", + "Recumbent Bicycle", + "Road Bicycle", + "Tandem Bicycle", + "Touring Bicycle", + "Track/Fixed-Gear Bicycle", + "Triathlon/Time Trial Bicycle", + "Tricycle" +];
\ No newline at end of file diff --git a/lib/locales/en/vehicle/index.js b/lib/locales/en/vehicle/index.js index 73407875..be00eef9 100644 --- a/lib/locales/en/vehicle/index.js +++ b/lib/locales/en/vehicle/index.js @@ -4,3 +4,4 @@ vehicle.manufacturer = require("./manufacturer"); vehicle.model = require("./model"); vehicle.type = require("./vehicle_type"); vehicle.fuel = require("./fuel"); +vehicle.bicycleType = require("./bicycle_type");
\ No newline at end of file diff --git a/lib/vehicle.js b/lib/vehicle.js index 7f1ae782..57326a36 100644 --- a/lib/vehicle.js +++ b/lib/vehicle.js @@ -129,6 +129,20 @@ var Vehicle = function (faker) { "description": "Generates a vehicle vrm", "sampleResults": ["MF56UPA", "GL19AAQ", "SF20TTA"] }; + + /** + * bicycleType + * + * @method faker.vehicle.bicycleType + */ + self.bicycleType = function () { + return faker.random.arrayElement(faker.definitions.vehicle.bicycle_type); + }; + + self.bicycleType.schema = { + "description": "Generates a type of bicycle", + "sampleResults": ["Adventure Road Bicycle", "City Bicycle", "Recumbent Bicycle"] + }; }; module["exports"] = Vehicle; diff --git a/test/vehicle.unit.js b/test/vehicle.unit.js index f03a7886..d5acadf7 100644 --- a/test/vehicle.unit.js +++ b/test/vehicle.unit.js @@ -71,4 +71,14 @@ describe("vehicle.js", function () { faker.vehicle.vrm.restore(); }); }); + + describe("bicycleType()", function () { + it("returns a random type of bicycle", function () { + sinon.stub(faker.vehicle, 'bicycleType').returns('Adventure Road Bicycle'); + var bicycleType = faker.vehicle.bicycleType(); + + assert.equal(bicycleType, 'Adventure Road Bicycle'); + faker.vehicle.bicycleType.restore(); + }); + }); }); |
