Changed to constructor functions

This commit is contained in:
Sebastian Seedorf
2020-05-26 19:40:41 +02:00
parent 9fa06685ba
commit 836b1449bf
15 changed files with 281 additions and 168 deletions

View File

@@ -7,8 +7,8 @@ import {
Deno.test("or (match)", async () => {
const values: [any, Validator[]][] = [
["", [isString, isInteger]],
[1, [isString, isInteger]],
["", [isString(), isInteger()]],
[1, [isString(), isInteger()]],
];
for (const [value, validators] of values) {
assertEquals(await validate(value, or(...validators)), []);
@@ -17,9 +17,9 @@ Deno.test("or (match)", async () => {
Deno.test("or (no match)", async () => {
const values: [any, Validator[]][] = [
[true, [isString, isInteger]],
[3.1415, [isString, isInteger]],
[1, [isString]],
[true, [isString(), isInteger()]],
[3.1415, [isString(), isInteger()]],
[1, [isString()]],
];
for (const [value, validators] of values) {
assertNotEquals(await validate(value, or(...validators)), []);