Comparing version 0.6.1 to 0.6.2
{ | ||
"name": "chance", | ||
"version": "0.6.1", | ||
"main": "chance.js", | ||
"ignore": ["node_modules"], | ||
"description": "Chance - Utility library to generate anything random", | ||
"homepage": "http://chancejs.com", | ||
"keywords": [ | ||
"chance", | ||
"random", | ||
"generator" | ||
], | ||
"author": { | ||
"name": "Victor Quinn", | ||
"web": "http://victorquinn.com" | ||
}, | ||
"devDependencies": { | ||
"mocha": "1.18.0", | ||
"chai": "~1.9.0", | ||
"requirejs": "~2.1.11", | ||
"lodash": "~2.4.1" | ||
} | ||
"name": "chance", | ||
"version": "0.6.2", | ||
"main": "chance.js", | ||
"ignore": [ | ||
"node_modules" | ||
], | ||
"description": "Chance - Utility library to generate anything random", | ||
"homepage": "http://chancejs.com", | ||
"keywords": [ | ||
"chance", | ||
"random", | ||
"generator" | ||
], | ||
"author": { | ||
"name": "Victor Quinn", | ||
"web": "http://victorquinn.com" | ||
}, | ||
"devDependencies": { | ||
"mocha": "1.18.0", | ||
"chai": "~1.9.0", | ||
"requirejs": "~2.1.11", | ||
"lodash": "~2.4.1", | ||
"phone_number_js": "~1.0.0" | ||
} | ||
} |
@@ -5,3 +5,3 @@ { | ||
"description": "Minimalist generator of random strings, numbers, etc.", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"keywords": ["chance", "random", "generator", "test"], | ||
@@ -8,0 +8,0 @@ "main": "chance.js", |
{ | ||
"name": "chance", | ||
"main": "./chance.js", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"description": "Chance - Utility library to generate anything random", | ||
@@ -6,0 +6,0 @@ "homepage": "http://chancejs.com", |
@@ -6,3 +6,4 @@ require.config({ | ||
'mocha': 'lib/mocha/mocha', | ||
'underscore': 'lib/lodash/dist/lodash' | ||
'underscore': 'lib/lodash/dist/lodash', | ||
'phoneTest': 'lib/phone_number_js/dist/phoneNumber.min' | ||
}, | ||
@@ -22,2 +23,5 @@ shim: { | ||
} | ||
}, | ||
'phoneTest': { | ||
exports: 'phoneNumber' | ||
} | ||
@@ -24,0 +28,0 @@ } |
@@ -8,4 +8,5 @@ { | ||
"requirejs": "~2.1.11", | ||
"lodash": "~2.4.1" | ||
"lodash": "~2.4.1", | ||
"phone_number_js": "~1.0.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
define(['Chance', 'mocha', 'chai', 'underscore'], function (Chance, mocha, chai, _) { | ||
define(['Chance', 'mocha', 'chai', 'underscore', 'phoneTest'], function (Chance, mocha, chai, _, phoneTest) { | ||
var assert = chai.assert, | ||
@@ -171,2 +171,66 @@ expect = chai.expect; | ||
}); | ||
it("phone({country: 'uk'}) returns a string", function () { | ||
expect(chance.phone({country: 'uk'})).to.be.a('string'); | ||
}); | ||
it("phone({country: 'uk', mobile: true}) returns a string", function () { | ||
expect(chance.phone({country: 'uk', mobile: true})).to.be.a('string'); | ||
}); | ||
it('phone({country: "uk"}) looks right', function () { | ||
_(1000).times(function () { | ||
expect(phoneTest.isValid(chance.phone({country: 'uk'}))).to.be.true; | ||
}); | ||
}); | ||
it('phone({country: "uk", formatted: false}) looks right', function () { | ||
_(1000).times(function () { | ||
expect(phoneTest.isValid(phoneTest.format(chance.phone({country: 'uk', formatted: false})))).to.be.true; | ||
}); | ||
}); | ||
it('phone({country: "uk", mobile: true}) looks right', function () { | ||
_(1000).times(function () { | ||
expect(phoneTest.isValid(chance.phone({country: 'uk', mobile: true}))).to.be.true; | ||
}); | ||
}); | ||
it('phone({country: "uk", mobile: true, formatted: false}) looks right', function () { | ||
_(1000).times(function () { | ||
expect(phoneTest.isValid(phoneTest.format(chance.phone({country: 'uk', mobile: true, formatted: false})))).to.be.true; | ||
}); | ||
}); | ||
it("phone({country: 'fr'}) returns a string", function () { | ||
expect(chance.phone({country: 'fr'})).to.be.a('string'); | ||
}); | ||
it("phone({country: 'fr', mobile: true}) returns a string", function () { | ||
expect(chance.phone({country: 'fr', mobile: true})).to.be.a('string'); | ||
}); | ||
it('phone({country: "fr"}) looks right', function () { | ||
_(1000).times(function () { | ||
expect(chance.phone({country: 'fr'})).match(/0[123459] .. .. .. ../); | ||
}); | ||
}); | ||
it('phone({country: "fr", formatted: false}) looks right', function () { | ||
_(1000).times(function () { | ||
expect(chance.phone({country: 'fr', formatted: false})).match(/0........./); | ||
}); | ||
}); | ||
it('phone({country: "fr", mobile: true}) looks right', function () { | ||
_(1000).times(function () { | ||
expect(chance.phone({country: 'fr', mobile: true})).match(/0[67] .. .. .. ../); | ||
}); | ||
}); | ||
it('phone({country: "fr", mobile: true, formatted: false}) looks right', function () { | ||
_(1000).times(function () { | ||
expect(chance.phone({country: 'fr', mobile: true, formatted: false})).match(/0[67]......../); | ||
}); | ||
}); | ||
}); | ||
@@ -173,0 +237,0 @@ |
@@ -121,2 +121,13 @@ define(['Chance', 'mocha', 'chai', 'underscore'], function (Chance, mocha, chai, _) { | ||
describe("Android Registration ID", function(){ | ||
var android_id, chance = new Chance(); | ||
it("returns a proper android id", function () { | ||
_(1000).times(function () { | ||
android_id = chance.android_id(); | ||
expect(android_id).to.match(/APA91([0-9a-zA-Z-_]){178}/); | ||
}); | ||
}); | ||
}); | ||
describe("Apple Token", function(){ | ||
@@ -245,2 +256,16 @@ var apple_token, chance = new Chance(); | ||
}); | ||
describe("CNPJ", function () { | ||
var chance = new Chance(); | ||
it("returns a valid Brazil company ID (CNPJ)", function () { | ||
_(1000).times(function () { | ||
cnpj = chance.cnpj(); | ||
expect(cnpj).to.be.a('string'); | ||
expect(cnpj).to.match(/^\d{2}.\d{3}.\d{3}\/\d{4}-\d{2}$/m); | ||
expect(cnpj).to.have.length(18); | ||
}); | ||
}); | ||
}); | ||
}); |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
164811
3322