client-side.js 824 B

123456789101112131415161718192021222324252627
  1. var assert = require('assert')
  2. , validator = require('../validator')
  3. , min = require('../validator.min');
  4. describe('Minified version', function () {
  5. it('should export the same things as the server-side version', function () {
  6. for (var key in validator) {
  7. assert.equal(typeof validator[key], typeof min[key], 'Minified version did not export ' + key);
  8. }
  9. });
  10. it('should be up to date', function () {
  11. assert.equal(min.version, validator.version, 'Minified version mismatch. Run `make min`');
  12. });
  13. it('should validate strings', function () {
  14. assert.equal(min.isEmail('foo@bar.com'), true);
  15. assert.equal(min.isEmail('foo'), false);
  16. });
  17. it('should sanitize strings', function () {
  18. assert.equal(min.toBoolean('1'), true);
  19. });
  20. });