Skip to content

Commit

Permalink
Update options validation spec
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscomorais committed Feb 13, 2020
1 parent 4884d6b commit c30f896
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/options/options_validation.spec.js
Expand Up @@ -26,12 +26,30 @@ describe('validation options', function() {
}});

var validate = ajv.compile({ format: 'identifier' });

validate('Abc1') .should.equal(true);
validate('123') .should.equal(false);
validate(123) .should.equal(true);
});
});

describe('keywords', function() {
it('should add keywords from options', function() {
var ajv = new Ajv({ keywords: {
identifier: {
validate: function (schema, data) {
return !data;
}
}
}});

var validate = ajv.compile({ identifier: true });

validate(true) .should.equal(false);
validate(false).should.equal(true);
});
});


describe('uniqueItems', function() {
it('should not validate uniqueItems with uniqueItems option == false', function() {
Expand Down

0 comments on commit c30f896

Please sign in to comment.