mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
✨ feat: unit test - utils - validateLength
This commit is contained in:
@@ -1 +1,2 @@
|
||||
import "./local/snowflake.ts";
|
||||
import "./util/validateLength.ts";
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import { validateLength } from "../../src/util/validate_length.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);
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user