@ende/expect/fn
ende add jsr:@ende/expectVersion 2026.10.15 on JSR.
This module contains a function to mock functions for testing and assertions.
import { fn, expect } from "@ende/expect";
Ende.test("example", () => {
const mockFn = fn((a: number, b: number) => a + b);
const result = mockFn(1, 2);
expect(result).toEqual(3);
expect(mockFn).toHaveBeenCalledWith(1, 2);
expect(mockFn).toHaveBeenCalledTimes(1);
});
Exports
fn— Creates a mock function that can be used for testing and assertions.