mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-30 15:30:07 +00:00
45 lines
995 B
TypeScript
45 lines
995 B
TypeScript
import { validateLength } from "../../src/util/validateLength.ts";
|
|
import { assertEquals } from "../deps.ts";
|
|
|
|
Deno.test({
|
|
name: "[utils] Validate length is too low",
|
|
fn() {
|
|
assertEquals(validateLength("test", { min: 5 }), false);
|
|
},
|
|
});
|
|
|
|
Deno.test({
|
|
name: "[utils] Validate length is too high",
|
|
fn() {
|
|
assertEquals(validateLength("test", { max: 3 }), false);
|
|
},
|
|
});
|
|
|
|
Deno.test({
|
|
name: "[utils] Validate length is NOT just right in between.",
|
|
fn() {
|
|
assertEquals(validateLength("test", { min: 5, max: 3 }), false);
|
|
},
|
|
});
|
|
|
|
Deno.test({
|
|
name: "[utils] Validate length is NOT too low",
|
|
fn() {
|
|
assertEquals(validateLength("test", { min: 3 }), true);
|
|
},
|
|
});
|
|
|
|
Deno.test({
|
|
name: "[utils] Validate length is NOT too high",
|
|
fn() {
|
|
assertEquals(validateLength("test", { max: 5 }), true);
|
|
},
|
|
});
|
|
|
|
Deno.test({
|
|
name: "[utils] Validate length is just right in between.",
|
|
fn() {
|
|
assertEquals(validateLength("test", { min: 3, max: 6 }), true);
|
|
},
|
|
});
|