2024-05-14 09:00:05 +02:00
|
|
|
import { describe, expect, it } from "bun:test";
|
2024-05-14 21:08:46 +02:00
|
|
|
import type { ValidationError } from "zod-validation-error";
|
|
|
|
|
import { EntityValidator } from "../index";
|
2024-05-14 09:00:05 +02:00
|
|
|
|
|
|
|
|
describe("Package testing", () => {
|
2024-05-14 21:08:46 +02:00
|
|
|
it("should not validate a bad Note", async () => {
|
2024-05-14 09:00:05 +02:00
|
|
|
const badObject = {
|
|
|
|
|
IamBad: "Note",
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-14 21:08:46 +02:00
|
|
|
const validator = new EntityValidator();
|
|
|
|
|
|
|
|
|
|
expect(validator.Note(badObject)).rejects.toThrow();
|
|
|
|
|
|
|
|
|
|
console.log(
|
|
|
|
|
(await validator.Note(badObject).catch((e) => e)).toString(),
|
|
|
|
|
);
|
2024-05-14 09:00:05 +02:00
|
|
|
});
|
|
|
|
|
});
|