Skip to content

Commit

Permalink
Merge branch 'feature/transform' of https://github.com/willfarrell/aj…
Browse files Browse the repository at this point in the history
…v-keywords into willfarrell-feature/transform
  • Loading branch information
epoberezkin committed Feb 9, 2019
2 parents 10647aa + b3c4623 commit 1b6eebb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec/transform.spec.js
Expand Up @@ -115,6 +115,11 @@ describe('keyword "transform"', function () {
e.message.should.equal('Invalid enum uniqueness. To use `transform:["toEnumCase"]`, all values must be unique when case insensitive.');
}

data = [' ph '];
schema = {type: 'array', items: {type: 'string', transform: ['trim', 'toEnumCase'], enum:['pH']}};
ajv.validate(schema, data) .should.equal(true);
data.should.deep.equal(['pH']);

data = ['ab'];
schema = {type: 'array', items: {type: 'string', transform: ['toEnumCase'], enum:['pH']}};
ajv.validate(schema, data) .should.equal(false);
Expand Down

0 comments on commit 1b6eebb

Please sign in to comment.