Skip to content

Commit

Permalink
Merge pull request #1127 from JasonHong1998/more-vehicles
Browse files Browse the repository at this point in the history
Issue #1097: add bicycleType in the vehicle module
  • Loading branch information
Marak authored Mar 9, 2021
2 parents b3382c1 + eb68134 commit 3cd9d21
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/locales/en/vehicle/bicycle.js
Original file line number Diff line number Diff line change
@@ -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"
];
1 change: 1 addition & 0 deletions lib/locales/en/vehicle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
14 changes: 14 additions & 0 deletions lib/vehicle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
10 changes: 10 additions & 0 deletions test/vehicle.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
});

0 comments on commit 3cd9d21

Please sign in to comment.