import { stub } from "mock"; /** * A shorthand for `new Uint8Array()`. */ export const b = (...bytes: number[]) => new Uint8Array(bytes); /** * @example * Deno.test("works", stubbingWarn(() => { * // ... * })); */ export const stubbingWarn = ( fn: (t: Deno.TestContext) => void | Promise, ): (t: Deno.TestContext) => Promise => ( async (t) => { const warnStub = stub(console, "warn"); try { return await fn(t); } finally { warnStub.restore(); } } );