Skip to content
Snippets Groups Projects
Select Git revision
  • e0e55fb2e7130af696dde002c9950a02ee2aad12
  • master default protected
  • 1.31
  • 4.24.3
  • 4.24.2
  • 4.24.1
  • 4.24.0
  • 4.23.6
  • 4.23.5
  • 4.23.4
  • 4.23.3
  • 4.23.2
  • 4.23.1
  • 4.23.0
  • 4.22.3
  • 4.22.2
  • 4.22.1
  • 4.22.0
  • 4.21.0
  • 4.20.1
  • 4.20.0
  • 4.19.0
  • 4.18.0
23 results

142.js

Blame
  • andoperator.mjs 1.04 KiB
    import {Valid} from "../../../../application/source/constraints/valid.mjs";
    import {Invalid} from "../../../../application/source/constraints/invalid.mjs";
    import {AndOperator} from "../../../../application/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();
                    })
    
                });
    
            });
    
        });
    });