UNPKG

@schukai/monster

Version:

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

39 lines (27 loc) 876 B
import {Base} from "../../../source/types/base.mjs"; import {AbstractOperator} from "../../../source/constraints/abstractoperator.mjs"; import {expect} from "chai" class AbstractConstraintMock extends Base { constructor() { super(); } isValid(value) { return Promise.reject(value); } } describe('AbstractOperator', function () { it('should throw an error when the constraint is not call with parameter', function (done) { try { new AbstractOperator() } catch (e) { done(); } }); it('should throw not an error when the constraint is not call with parameter', function (done) { try { const c = new AbstractOperator(new AbstractConstraintMock(), new AbstractConstraintMock()) } catch (e) { done(); } }); });