Mock Function

A test function that records calls and can return controlled values.

What is Mock Function in JavaScript?

Mock Function — A test function that records calls and can return controlled values.

test("totals an order", () => {
    expect(total(3, 4)).toBe(12);
});

Level: Freelancer · More JavaScript terms at this level

Updated