aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarak <[email protected]>2018-09-24 10:26:36 -0400
committerGitHub <[email protected]>2018-09-24 10:26:36 -0400
commit98a47b9aa5d7e749dabb6c5afa0907d574904871 (patch)
treedbc66d737ee11687d3bde5ee02f42940b6218fdd
parent07f39bd34ea8f35f40d4330b42c44503e1aa6561 (diff)
parentace7730a5d2daef150bf78704190a1cef65976ff (diff)
downloadfaker-98a47b9aa5d7e749dabb6c5afa0907d574904871.tar.xz
faker-98a47b9aa5d7e749dabb6c5afa0907d574904871.zip
Merge pull request #691 from simone-sanfratello/master
[fix] system.directoryPath and system.filePath
-rw-r--r--lib/index.js2
-rw-r--r--test/system.unit.js20
2 files changed, 21 insertions, 1 deletions
diff --git a/lib/index.js b/lib/index.js
index 142205d9..16c4399f 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -113,7 +113,7 @@ function Faker (opts) {
"internet": ["avatar_uri", "domain_suffix", "free_email", "example_email", "password"],
"commerce": ["color", "department", "product_name", "price", "categories"],
"database": ["collation", "column", "engine", "type"],
- "system": ["mimeTypes"],
+ "system": ["mimeTypes", "directoryPaths"],
"date": ["month", "weekday"],
"title": "",
"separator": ""
diff --git a/test/system.unit.js b/test/system.unit.js
index 1edcb8be..dfcfcb0b 100644
--- a/test/system.unit.js
+++ b/test/system.unit.js
@@ -5,6 +5,26 @@ if (typeof module !== 'undefined') {
}
describe("system.js", function () {
+ describe("directoryPath()", function () {
+ it("returns unix fs directory full path", function () {
+ sinon.stub(faker.random, 'words').returns('24/7');
+ var directoryPath = faker.system.directoryPath();
+ assert.equal(directoryPath.indexOf('/'), 0, 'generated directoryPath should start with /');
+
+ faker.random.words.restore();
+ });
+ });
+
+ describe("filePath()", function () {
+ it("returns unix fs file full path", function () {
+ sinon.stub(faker.random, 'words').returns('24/7');
+ var filePath = faker.system.filePath();
+ assert.equal(filePath.indexOf('/'), 0, 'generated filePath should start with /');
+
+ faker.random.words.restore();
+ });
+ });
+
describe("fileName()", function () {
it("returns filenames without system path seperators", function () {
sinon.stub(faker.random, 'words').returns('24/7');