Comparing version 0.6.0 to 0.6.1
{ | ||
"name": "chance", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"main": "chance.js", | ||
@@ -5,0 +5,0 @@ "ignore": ["node_modules"], |
@@ -5,3 +5,3 @@ { | ||
"description": "Minimalist generator of random strings, numbers, etc.", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"keywords": ["chance", "random", "generator", "test"], | ||
@@ -8,0 +8,0 @@ "main": "chance.js", |
{ | ||
"name": "chance", | ||
"main": "./chance.js", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Chance - Utility library to generate anything random", | ||
@@ -6,0 +6,0 @@ "homepage": "http://chancejs.com", |
@@ -110,15 +110,15 @@ # Chance | ||
repo age : 1 year, 2 months | ||
active : 87 days | ||
commits : 336 | ||
active : 89 days | ||
commits : 346 | ||
files : 21 | ||
authors : | ||
249 Victor Quinn 74.1% | ||
13 Tim Petricola 3.9% | ||
11 davmillar 3.3% | ||
5 Michael Cordingley 1.5% | ||
5 Alex DiLiberto 1.5% | ||
5 Matt Klaber 1.5% | ||
4 Abhijeet Pawar 1.2% | ||
257 Victor Quinn 74.3% | ||
13 Tim Petricola 3.8% | ||
11 davmillar 3.2% | ||
5 Alex DiLiberto 1.4% | ||
5 Matt Klaber 1.4% | ||
5 Michael Cordingley 1.4% | ||
4 Kevin Garnett 1.2% | ||
4 Avishaan 1.2% | ||
4 Abhijeet Pawar 1.2% | ||
3 qjcg 0.9% | ||
@@ -130,2 +130,3 @@ 3 Alexandr Lozovyuk 0.9% | ||
2 Andreas Koeberle 0.6% | ||
2 Chris Villarreal 0.6% | ||
2 Iskren Chernev 0.6% | ||
@@ -132,0 +133,0 @@ 2 Pascal Borreli 0.6% |
@@ -51,2 +51,27 @@ define(['Chance', 'mocha', 'chai', 'underscore'], function (Chance, mocha, chai, _) { | ||
it("works with just 2 items", function() { | ||
// Use Math.random as the random function rather than our Mersenne twister just to | ||
// speed things up here because this test takes awhile to gather enough data to | ||
// have a large enough sample size to adequately test. This increases speed | ||
// by a few orders of magnitude at the cost of repeatability (which we aren't using here) | ||
var chance = new Chance(Math.random); | ||
var picked = { a: 0, b: 0 }; | ||
// This makes it a tad slow, but we need a large enough sample size to adequately test | ||
_(100000).times(function () { | ||
picked[chance.weighted(['a', 'b'], [1, 100])]++; | ||
}); | ||
// This range is somewhat arbitrary, but good enough to test our constraints | ||
expect(picked.b / picked.a).to.be.within(80, 120); | ||
picked = { a: 0, b: 0 }; | ||
// This makes it a tad slow, but we need a large enough sample size to adequately test | ||
_(100000).times(function () { | ||
picked[chance.weighted(['a', 'b'], [100, 1])]++; | ||
}); | ||
// This range is somewhat arbitrary, but good enough to test our constraints | ||
expect(picked.a / picked.b).to.be.within(80, 120); | ||
}); | ||
it("throws an error if called with an array of weights with length different from options", function() { | ||
@@ -53,0 +78,0 @@ expect(function () { |
@@ -158,3 +158,14 @@ define(['Chance', 'mocha', 'chai', 'underscore'], function (Chance, mocha, chai, _) { | ||
}); | ||
describe("cpf()", function () { | ||
it("returns a random valid taxpayer number for Brazil citizens (CPF)", function () { | ||
_(1000).times(function () { | ||
cpf = chance.cpf(); | ||
expect(cpf).to.be.a('string'); | ||
expect(cpf).to.match(/^\d{3}.\d{3}.\d{3}-\d{2}$/m); | ||
expect(cpf).to.have.length(14); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
154517
3135
162