forked from validatorjs/validator.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
3,052 additions
and
2,944 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
validator.js | ||
validator.min.js | ||
test | ||
validator.min.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
var assert = require('assert') | ||
, validator = require('../validator') | ||
, min = require('../validator.min'); | ||
var assert = require('assert'); | ||
var validator = require('../validator'); | ||
var min = require('../validator.min'); | ||
|
||
describe('Minified version', function () { | ||
it('should export the same things as the server-side version', function () { | ||
for (var key in validator) { | ||
if ({}.hasOwnProperty.call(validator, key)) { | ||
assert.equal(typeof validator[key], | ||
typeof min[key], 'Minified version did not export ' + key); | ||
} | ||
} | ||
}); | ||
|
||
it('should export the same things as the server-side version', function () { | ||
for (var key in validator) { | ||
assert.equal(typeof validator[key], typeof min[key], 'Minified version did not export ' + key); | ||
} | ||
}); | ||
it('should be up to date', function () { | ||
assert.equal(min.version, validator.version, 'Minified version mismatch. Run `make min`'); | ||
}); | ||
|
||
it('should be up to date', function () { | ||
assert.equal(min.version, validator.version, 'Minified version mismatch. Run `make min`'); | ||
}); | ||
|
||
it('should validate strings', function () { | ||
assert.equal(min.isEmail('[email protected]'), true); | ||
assert.equal(min.isEmail('foo'), false); | ||
}); | ||
|
||
it('should sanitize strings', function () { | ||
assert.equal(min.toBoolean('1'), true); | ||
}); | ||
it('should validate strings', function () { | ||
assert.equal(min.isEmail('[email protected]'), true); | ||
assert.equal(min.isEmail('foo'), false); | ||
}); | ||
|
||
it('should sanitize strings', function () { | ||
assert.equal(min.toBoolean('1'), true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
var assert = require('assert') | ||
, validator = require('../index'); | ||
var assert = require('assert'); | ||
var validator = require('../index'); | ||
|
||
describe('Exports', function () { | ||
it('should export validators', function () { | ||
assert.equal(typeof validator.isEmail, 'function'); | ||
assert.equal(typeof validator.isAlpha, 'function'); | ||
}); | ||
|
||
it('should export validators', function () { | ||
assert.equal(typeof validator.isEmail, 'function'); | ||
assert.equal(typeof validator.isAlpha, 'function'); | ||
}); | ||
|
||
it('should export sanitizers', function () { | ||
assert.equal(typeof validator.toBoolean, 'function'); | ||
assert.equal(typeof validator.toFloat, 'function'); | ||
}); | ||
|
||
it('should export the version number', function () { | ||
assert.equal(validator.version, require('../package.json').version, | ||
'Version number mismatch in "package.json" vs. "validator.js"'); | ||
}); | ||
it('should export sanitizers', function () { | ||
assert.equal(typeof validator.toBoolean, 'function'); | ||
assert.equal(typeof validator.toFloat, 'function'); | ||
}); | ||
|
||
it('should export the version number', function () { | ||
assert.equal(validator.version, require('../package.json').version, | ||
'Version number mismatch in "package.json" vs. "validator.js"'); | ||
}); | ||
}); |
Oops, something went wrong.