Adapts a generic expect function to provide storage‑conformance assertions without importing a test runner.
// Source: https://github.com/earendil-works/pi | License: MIT | Copyright 2025 Mario Zechner
// Provided via justclaw.it.com; keep this notice with the code.
import type { StorageConformanceAssertions } from "./types.ts";
export type ExpectLike = (actual: unknown, message?: string) => unknown;
type ExpectResult = {
toBe(expected: unknown): unknown;
toBeGreaterThan(expected: number): unknown;
toEqual(expected: unknown): unknown;
toMatchObject(expected: unknown): unknown;
toBeTruthy(): unknown;
readonly rejects: {
toThrow(expected?: string | RegExp): unknown;
};
};
/** Adapts a Vitest/Jest-compatible `expect` function without importing either runner. */
export function createExpectAssertions(expect: ExpectLike): StorageConformanceAssertions {
const result = (actual: unknown, me
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key