Skip to content

Commit

Permalink
Add uuid generator
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed May 25, 2016
1 parent 7e24e9b commit 4c6d216
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/locales/default/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ module.exports = {
company: require("./company"),
internet: require("./internet"),
lorem: require("./lorem"),
date: require("./date")
date: require("./date"),
misc: require("./misc")
};
5 changes: 5 additions & 0 deletions lib/locales/default/misc/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import uuid from "uuid";

module.exports = {
uuid: uuid.v4
};
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"src",
"vendor",
"test"
],
],
"keywords": [
"fake",
"contextual",
Expand All @@ -53,7 +53,7 @@
"eslint": "2.9.0",
"eslint-friendly-formatter": "2.0.4",
"inject-loader": "2.0.1",
"isparta-loader": "2.0.0",
"isparta-loader": "2.0.0",
"karma": "0.13.9",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "1.0.1",
Expand All @@ -66,14 +66,15 @@
"karma-spec-reporter": "0.0.26",
"karma-webpack": "1.7.0",
"lodash": "4.12.0",
"lolex": "1.4.0",
"lolex": "1.4.0",
"mocha": "2.4.5",
"mocha-generators": "1.2.0",
"mocha-loader": "0.7.1",
"mocha-loader": "0.7.1",
"password-generator": "2.0.2",
"phantomjs-prebuilt": "2.1.3",
"sinon": "1.17.4",
"sinon-chai": "2.8.0",
"uuid": "2.0.2",
"webpack": "1.13.0",
"webpack-merge": "0.12.0"
}
Expand Down
26 changes: 26 additions & 0 deletions test/specs/locales/default/misc.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { expect } from "chai";

import Fakerator from "lib/fakerator";

describe("Default misc", () => {

let fakerator;

beforeEach( () => {
fakerator = new Fakerator();
fakerator.seed(8080);
});

it("check misc.uuid", () => {
expect(fakerator.populate("#{misc.uuid}")).to.be
.an("String")
.length(36)
.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);

expect(fakerator.misc.uuid()).to.be
.an("String")
.length(36)
.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);
});

})

0 comments on commit 4c6d216

Please sign in to comment.