UNPKG

615 BJavaScriptView Raw
1const assert = require('assert');
2
3const { Validator } = require('../../lib/index');
4
5describe('all', () => {
6 it('should return true when all fields exists', async () => {
7 const v = new Validator({ field1: '1', field2: '2', field3: '3' }, { '*': 'all:field1,field2,field3' });
8
9 const matched = await v.check();
10
11 assert.equal(matched, true);
12 });
13
14 it('should return false when there is one field missing', async () => {
15 const v = new Validator({ field1: '1', field2: '2' }, { '*': 'all:field1,field2,field3' });
16
17 const matched = await v.check();
18
19 assert.equal(matched, false);
20 });
21});