Module

x/err/err.import_denoland.test.ts

simple payload wrapper around Error
Latest
File
import { expect } from "https://deno.land/x/expect/mod.ts";import Err, { PAYLOAD } from "https://deno.land/x/err/mod.ts";
(function test_err_with_payload() { const [$foo, $bar] = ["foo", Symbol("bar")]; const $payload = { $foo, $bar }; const $err_msg = ["test_error_message"].join(":"); const err = new Err($err_msg); const err_with_payload = err.with($payload); Deno.test("returns self", () => { expect(err_with_payload).toBe(err); }); Deno.test("has expected payload", () => { // @ts-ignore expect(err_with_payload).toHaveProperty(PAYLOAD); expect(err_with_payload.payload).toBe($payload); });})();