Comparing version 1.0.12 to 1.0.13
{ | ||
"name": "chance", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"main": "chance.js", | ||
@@ -5,0 +5,0 @@ "ignore": [ |
const gulp = require('gulp') | ||
const ava = require('gulp-ava') | ||
const eslint = require('gulp-eslint') | ||
const ava = require('gulp-ava') | ||
const rename = require('gulp-rename') | ||
const sourcemaps = require('gulp-sourcemaps') | ||
const uglify = require('gulp-uglify') | ||
const pump = require('pump') | ||
@@ -40,4 +44,11 @@ gulp.task('lint', () => | ||
gulp.task('build', function (cb) { | ||
pump([ gulp.src('chance.js'), sourcemaps.init(), | ||
rename('chance.min.js'), uglify(), sourcemaps.write('.'), | ||
gulp.dest('dist'), | ||
], cb) | ||
}) | ||
gulp.task('travis', ['lint', 'test']) | ||
gulp.task('default', ['watch', 'lint', 'test']) |
{ | ||
"name": "chance", | ||
"main": "./chance.js", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "Chance - Utility library to generate anything random", | ||
@@ -26,5 +26,9 @@ "homepage": "http://chancejs.com", | ||
"gulp-jshint": "^2.0.4", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-sourcemaps": "^2.6.1", | ||
"gulp-uglify": "^3.0.0", | ||
"jshint-stylish": "^2.2.1", | ||
"lodash": "^4.17.4", | ||
"nyc": "^10.3.2" | ||
"nyc": "^10.3.2", | ||
"pump": "^1.0.2" | ||
}, | ||
@@ -60,3 +64,4 @@ "scripts": { | ||
] | ||
} | ||
}, | ||
"dependencies": {} | ||
} |
@@ -123,2 +123,15 @@ import test from 'ava' | ||
// chance.county() | ||
test('county() returns a random county name', t => { | ||
_.times(1000, () => { | ||
t.true(_.isString(chance.county())) | ||
}) | ||
}) | ||
test('country() returns a random (long) country name', t => { | ||
_.times(1000, () => { | ||
t.true(chance.country({ full: true }).length > 2) | ||
}) | ||
}) | ||
// chance.depth() | ||
@@ -471,2 +484,6 @@ test('depth() looks right', t => { | ||
test('street() works with it country', t => { | ||
_.times(100, () => t.is(typeof chance.street({ country: 'it' }), 'string')) | ||
}) | ||
// chance.street_suffix() | ||
@@ -473,0 +490,0 @@ test('street_suffix() returns a single suffix', t => { |
@@ -129,2 +129,10 @@ import test from 'ava' | ||
// chance.euro() | ||
test('euro() returns a proper euro amount', t => { | ||
let euro = chance.euro() | ||
t.true(/[0-9]+,?\.?[0-9]+?€/.test(euro)) | ||
let euroFloat = parseFloat(euro.substring(euro.length, -1)) | ||
t.true(euroFloat < 10001) | ||
}) | ||
// chance.exp() | ||
@@ -131,0 +139,0 @@ test('exp() looks correct', t => { |
@@ -143,2 +143,10 @@ import test from 'ava' | ||
// chance.cnpj() | ||
test('cnpj() returns a random cnpj', t => { | ||
_.times(1000, () => { | ||
let hidn = chance.HIDN() | ||
t.true(_.isString(hidn)) | ||
}) | ||
}) | ||
// chance.company() | ||
@@ -186,2 +194,12 @@ test('company() returns a random company', t => { | ||
// chance.HIDN() | ||
test('HIDN() returns a random HIDN', t => { | ||
_.times(1000, () => { | ||
let hidn = chance.HIDN() | ||
t.true(_.isString(hidn)) | ||
t.true(/^\d{6}[A-Z]{2}$/m.test(hidn)) | ||
t.is(hidn.length, 8) | ||
}) | ||
}) | ||
// chance.israelId() | ||
@@ -188,0 +206,0 @@ test('israelId() returns a valid Isreal id', t => { |
@@ -57,2 +57,12 @@ import test from 'ava' | ||
test('word() obeys the capitalize option', t => { | ||
_.times(1000, () => { | ||
let word = chance.word({ capitalize: true }) | ||
t.true(_.isString(word)) | ||
t.true(word.length > 1) | ||
t.true(word.length < 10) | ||
t.true(word.charAt(0) === word.charAt(0).toUpperCase()) | ||
}) | ||
}) | ||
test('word() can have a set number of syllables', t => { | ||
@@ -59,0 +69,0 @@ _.times(1000, () => { |
@@ -27,3 +27,3 @@ import test from 'ava' | ||
_.times(1000, () => { | ||
let date = chance.date({ american: true }) | ||
let date = chance.date({ american: chance.bool() }) | ||
t.true(_.isDate(date)) | ||
@@ -237,2 +237,12 @@ t.truthy(date.getTime()) | ||
// chance.timezone() | ||
test('timezone() returns a timezone', t => { | ||
_.times(1000, () => { | ||
let timezone = chance.timezone() | ||
t.true(_.isString(timezone.name)) | ||
t.true(timezone.abbr.length < 6) | ||
t.true(_.isNumber(timezone.offset)) | ||
}) | ||
}) | ||
// chance.weekday() | ||
@@ -239,0 +249,0 @@ test('weekday() will return a weekday as a string', t => { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1247385
11103
16