diff options
| author | Marak <[email protected]> | 2021-03-09 09:06:19 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-03-09 09:06:19 -0500 |
| commit | 3cd9d21d24b0796c0505285ec64ce9e75f1979a8 (patch) | |
| tree | 911279c1b02b92ccfde2786a684a79d9355fd9aa | |
| parent | b3382c1d7a5ce6d08c372b11068092c35d5fe826 (diff) | |
| parent | eb681348d5b5ac1fcafce3eacb78995f57407447 (diff) | |
| download | faker-3cd9d21d24b0796c0505285ec64ce9e75f1979a8.tar.xz faker-3cd9d21d24b0796c0505285ec64ce9e75f1979a8.zip | |
Merge pull request #1127 from JasonHong1998/more-vehicles
Issue #1097: add bicycleType in the vehicle module
| -rw-r--r-- | lib/locales/en/vehicle/bicycle.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.js b/lib/locales/en/vehicle/bicycle.js new file mode 100644 index 00000000..519e3525 --- /dev/null +++ b/lib/locales/en/vehicle/bicycle.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..4a2c8172 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.bicycle = require("./bicycle");
\ No newline at end of file diff --git a/lib/vehicle.js b/lib/vehicle.js index 7f1ae782..125055e6 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"] }; + + /** + * bicycle + * + * @method faker.vehicle.bicycle + */ + self.bicycle = function () { + return faker.random.arrayElement(faker.definitions.vehicle.bicycle_type); + }; + + self.bicycle.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..80504581 100644 --- a/test/vehicle.unit.js +++ b/test/vehicle.unit.js @@ -71,4 +71,14 @@ describe("vehicle.js", function () { faker.vehicle.vrm.restore(); }); }); + + describe("bicycle()", function () { + it("returns a random type of bicycle", function () { + sinon.stub(faker.vehicle, 'bicycle').returns('Adventure Road Bicycle'); + var bicycle = faker.vehicle.bicycle(); + + assert.equal(bicycle, 'Adventure Road Bicycle'); + faker.vehicle.bicycle.restore(); + }); + }); }); |
