UNPKG

@schukai/monster

Version:

Monster is a simple library for creating fast, robust and lightweight websites.

36 lines (25 loc) 1.02 kB
import {Valid} from "../../../source/constraints/valid.mjs"; import {Invalid} from "../../../source/constraints/invalid.mjs"; import {AndOperator} from "../../../source/constraints/andoperator.mjs"; describe('AndOperator', function () { describe('.isValid()', function () { [ [new Valid(), new Valid(), true], [new Valid(), new Invalid(), false], [new Invalid(), new Valid(), false], [new Invalid(), new Invalid(), false] ].forEach(function (data) { let a = data.shift() let b = data.shift() let c = data.shift() it('constraint.isValid() should return ' + c, function (done) { let constraint = new AndOperator(a, b); constraint.isValid().then(() => { c === true ? done() : done(new Error()); }).catch(() => { c === true ? done(new Error()) : done(); }) }); }); }); });