mirror of
https://github.com/kou029w/_.git
synced 2025-01-31 06:18:07 +00:00
14 lines
397 B
TypeScript
14 lines
397 B
TypeScript
|
import assert from "node:assert";
|
||
|
import { deserializeError, serializeError } from "npm:serialize-error";
|
||
|
import { E } from "./main.ts";
|
||
|
|
||
|
Deno.test("serializeError", () => {
|
||
|
const e = serializeError(new E());
|
||
|
assert(e.code === "ERR");
|
||
|
assert(e.stack?.match(/^Error\n/));
|
||
|
});
|
||
|
|
||
|
Deno.test("deserializeError", () => {
|
||
|
assert(deserializeError({ name: "E", message: "🦄" }) instanceof E);
|
||
|
});
|