Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
import { describe, expect, it } from "vitest";
import ValidationError from "./validation_error.js";
describe("ValidationError", () => {
it("copies every key from the response onto the instance", () => {
const err = new ValidationError({ message: "bad request", status: 400 }) as any;
expect(err.message).toBe("bad request");
expect(err.status).toBe(400);
expect(err).toBeInstanceOf(ValidationError);
});
it("handles an empty response without copying any keys", () => {
const err = new ValidationError({}) as any;
expect(Object.keys(err)).toEqual([]);
expect(err).toBeInstanceOf(ValidationError);
});
});