Icontem

File: test/postRules/all.js

Recommend this page to a friend!
  Classes of Harcharan Singh  >  Node Input Validator  >  test/postRules/all.js  >  Download  
File: test/postRules/all.js
Role: Example script
Content type: text/plain
Description: Example script
Class: Node Input Validator
Validate submitted input values in Node.js
Author: By
Last change:
Date: 6 months ago
Size: 657 bytes
 

Contents

Class file image Download
const assert = require('assert');

const Validator = require('../../index');

let r = {};


describe('all', function () {

    it('should return true when all fields exists', async () => {

        let v = new Validator({ field1: '1', field2: '2', field3: '3' }, { '*': 'all:field1,field2,field3' });

        let matched = await v.check();

        assert.equal(matched, true);

    });

    it('should return false when there is one field missing', async () => {

        let v = new Validator({ field1: '1', field2: '2' }, { '*': 'all:field1,field2,field3' });

        let matched = await v.check();

        assert.equal(matched, false);

    });

});