UNPKG

666 BJavaScriptView Raw
1if (typeof require !== 'undefined') {
2 var Validator = require('../src/validator.js');
3 var expect = require('chai').expect;
4} else {
5 var Validator = window.Validator;
6 var expect = window.chai.expect;
7}
8
9describe('present validation rule', function() {
10 it('should pass with attribute present', function() {
11 var validator = new Validator({
12 email: 'name@domain.com',
13 }, {
14 email: 'present',
15 });
16 expect(validator.passes()).to.be.true;
17 });
18
19 it('should fail with attribute not present', function() {
20 var validator = new Validator({
21 }, {
22 email: 'present',
23 });
24 expect(validator.passes()).to.be.false;
25 });
26
27});