aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarak <[email protected]>2017-02-28 18:00:37 -0500
committerGitHub <[email protected]>2017-02-28 18:00:37 -0500
commitd9369eafe02c442b455cd775f9a69a094f16a704 (patch)
tree62ed9fb01303ab7ed0ef587d042ee76f0bd92709 /test
parentf379057be0112d6732b056d93d1380be18e1087a (diff)
parent38d2f3449e1e5a78c7215e6c8f6346c0fd0a652b (diff)
downloadfaker-d9369eafe02c442b455cd775f9a69a094f16a704.tar.xz
faker-d9369eafe02c442b455cd775f9a69a094f16a704.zip
Merge pull request #478 from APIs-guru/master
[fix] Generation of float numbers
Diffstat (limited to 'test')
-rw-r--r--test/random.unit.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/random.unit.js b/test/random.unit.js
index 6214039b..133fd887 100644
--- a/test/random.unit.js
+++ b/test/random.unit.js
@@ -56,6 +56,14 @@ describe("random.js", function () {
});
+ it("provides numbers with a with exact precision", function() {
+ var options = { min: 0.5, max: 0.99, precision: 0.01 };
+ for(var i = 0; i < 100; i++) {
+ var number = faker.random.number(options);
+ assert.equal(number, Number(number.toFixed(2)));
+ }
+ });
+
it("should not modify the input object", function() {
var min = 1;
var max = 2;