import "../setup.ts"; import { assert, assertFalse } from "@std/assert"; import { isCreateCommentRequest, isUpdateCommentRequest, } from "../../validators/comment.ts"; Deno.test("comment requests: non-blank, bounded, optional parent", () => { assert(isCreateCommentRequest({ body: "hi" })); assert(isCreateCommentRequest({ body: "hi", parentId: null })); assert(isCreateCommentRequest({ body: "hi", parentId: "p" })); assertFalse(isCreateCommentRequest({ body: " " })); assertFalse(isCreateCommentRequest({ body: "x".repeat(5001) })); assertFalse(isCreateCommentRequest({ body: "hi", parentId: 3 })); assert(isUpdateCommentRequest({ body: "edit" })); assertFalse(isUpdateCommentRequest({ body: "" })); });