-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexclusion.test.js
38 lines (29 loc) · 1.25 KB
/
exclusion.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
const expect = require('chai').expect;
const validators = require('../src/common-validators');
describe('exclusion', function() {
it('value doesn\'t in array', function() {
expect(validators.exclusion('d', ['a', 'b', 'c'])).to.be.undefined;
});
it('value doesn\'t in object keys', function() {
expect(validators.exclusion('d', {a: 'smth'})).to.be.undefined;
});
it('array doesn\'t in array', function() {
expect(validators.exclusion(['d', 'e'], ['a', 'b', 'c'])).to.be.undefined;
});
it('object keys don\'t in object keys', function() {
expect(validators.exclusion({d: 1, e: 2}, {a: 1, b: 2, c: 3})).to.be.undefined;
});
it('value is in array', function() {
expect(validators.exclusion('a', ['a', 'b', 'c'])).to.have.property('error');
});
it('value is in object keys', function() {
expect(validators.exclusion('a', {a: 'smth'})).to.have.property('error');
});
it('array is in array', function() {
expect(validators.exclusion(['a', 'b'], ['a', 'b', 'c'])).to.have.property('error');
});
it('object keys are in object keys', function() {
expect(validators.exclusion({a: 1, b: 2}, {a: 1, b: 2, c: 3})).to.have.property('error');
});
});