Comparing version 0.7.6 to 0.7.7
{ | ||
"name": "chance", | ||
"version": "0.7.6", | ||
"version": "0.7.7", | ||
"main": "chance.js", | ||
@@ -5,0 +5,0 @@ "ignore": [ |
@@ -5,3 +5,3 @@ { | ||
"description": "Minimalist generator of random strings, numbers, etc.", | ||
"version": "0.7.6", | ||
"version": "0.7.7", | ||
"keywords": ["chance", "random", "generator", "test"], | ||
@@ -8,0 +8,0 @@ "main": "chance.js", |
@@ -68,9 +68,9 @@ module.exports = function (grunt) { | ||
uglify: { | ||
my_target: { | ||
dist: { | ||
options: { | ||
sourceMap: true, | ||
sourceMapName: 'chance.min.js.map' | ||
sourceMapName: 'dist/chance.min.js.map' | ||
}, | ||
files: { | ||
'chance.min.js': ['chance.js'] | ||
'dist/chance.min.js': ['chance.js'] | ||
} | ||
@@ -77,0 +77,0 @@ } |
{ | ||
"name": "chance", | ||
"main": "./chance.js", | ||
"version": "0.7.6", | ||
"version": "0.7.7", | ||
"description": "Chance - Utility library to generate anything random", | ||
@@ -6,0 +6,0 @@ "homepage": "http://chancejs.com", |
@@ -101,2 +101,6 @@ /// <reference path="../chance.js" /> | ||
it("states({territories: true, us_states_and_dc: false}) returns 7 US Territories", function () { | ||
expect(chance.states({territories: true, us_states_and_dc: false})).to.have.length(7); | ||
}); | ||
it("states({armed_forces: true}) returns 50 US States, DC, and 3 Armed Forces Military States", function () { | ||
@@ -106,5 +110,13 @@ expect(chance.states({armed_forces: true})).to.have.length(54); | ||
it("states({armed_forces: true, us_states_and_dc: false}) returns 3 Armed Forces Military States", function () { | ||
expect(chance.states({armed_forces: true, us_states_and_dc: false})).to.have.length(3); | ||
}); | ||
it("states({territories: true, armed_forces: true}) returns 50 US States, DC, 7 US Territories, and 3 Armed Forces Military States", function () { | ||
expect(chance.states({territories: true, armed_forces: true})).to.have.length(61); | ||
}); | ||
it("states({territories: true, armed_forces: true, us_states_and_dc: false}) returns 7 US Territories and 3 Armed Forces Military States", function () { | ||
expect(chance.states({territories: true, armed_forces: true, us_states_and_dc: false})).to.have.length(10); | ||
}); | ||
}); | ||
@@ -338,3 +350,3 @@ | ||
_(1000).times(function () { | ||
expect(chance.depth()).to.be.within(-2550, 0); | ||
expect(chance.depth()).to.be.within(-10994, 0); | ||
}); | ||
@@ -345,3 +357,3 @@ }); | ||
_(1000).times(function () { | ||
var min = chance.floating({min: -2500, max: 0}); | ||
var min = chance.floating({min: -10994, max: 0}); | ||
expect(chance.depth({min: min})).to.be.within(min, 0); | ||
@@ -353,4 +365,4 @@ }); | ||
_(1000).times(function () { | ||
var max = chance.floating({min: -2500, max: 0}); | ||
expect(chance.depth({max: max})).to.be.within(-2550, max); | ||
var max = chance.floating({min: -10994, max: 0}); | ||
expect(chance.depth({max: max})).to.be.within(-10994, max); | ||
}); | ||
@@ -357,0 +369,0 @@ }); |
@@ -41,7 +41,7 @@ /* jshint newcap:false */ | ||
// Note: In very extreme circumstances this test may fail as, by its | ||
// nature it's random. But it's a low enough percentage that I'm | ||
// willing to accept it. | ||
// Award to anyone that calculates the actual probability of this | ||
// test failing and submits a pull request adding it to this comment! | ||
// The probability of this test failing is approximately 4.09e-86. | ||
// So, in theory, it could give a false negative, but the sun will | ||
// probably die long before that happens. | ||
// | ||
// See calculation here https://gist.github.com/BlaMaeda/cfd886f84dd093cb2ead | ||
expect(true_count).to.be.within(200, 800); | ||
@@ -48,0 +48,0 @@ }); |
@@ -261,2 +261,20 @@ /// <reference path="../chance.js" /> | ||
describe("israelId()",function(){ | ||
it("Should return a valid israel ID",function(){ | ||
_(1000).times(function () { | ||
var x=chance.israelId(); | ||
expect(x).to.have.length(9); | ||
var y=0; | ||
for (var i=0;i<8;i++){ | ||
var thisDigit= x[i] * (i/2===parseInt(i/2) ? 1 : 2); | ||
thisDigit=chance.pad(thisDigit,2).toString(); | ||
thisDigit=parseInt(thisDigit[0]) + parseInt(thisDigit[1]); | ||
y=y+thisDigit; | ||
} | ||
var lastDigit=(10-parseInt(y.toString().slice(-1)).toString().slice(-1)).toString().slice(-1); | ||
expect(x[8]).to.equal(lastDigit); | ||
}); | ||
}); | ||
}); | ||
describe('mrz()', function() { | ||
@@ -263,0 +281,0 @@ it('should return a valid passport number when given valid inputs', function() { |
Sorry, the diff of this file is not supported yet
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
372126
27
5224