UNPKG

@mendix/pluggable-widgets-tools

Version:
22 lines (21 loc) 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const validation_1 = require("../validation"); describe("Validation Utilities", () => { describe("throwOnIllegalChars", () => { it("throws when the input does not match the pattern", () => { expect(validation_1.throwOnIllegalChars.bind(null, "abc", "0-9", "Test")).toThrow(validation_1.WidgetValidationError); }); it("does not throw when the input does match the pattern", () => { expect(validation_1.throwOnIllegalChars.bind(null, "abc", "a-z", "Test")).not.toThrow(); }); }); describe("throwOnNoMatch", () => { it("throws when the input does not match the pattern", () => { expect(validation_1.throwOnNoMatch.bind(null, "abc", /^$/, "Test")).toThrow(validation_1.WidgetValidationError); }); it("does not throw when the input does match the pattern", () => { expect(validation_1.throwOnNoMatch.bind(null, "abc", /[a-z]/, "Test")).not.toThrow(); }); }); });