The Lest Object
Mock Functions
lest.fn(implementation?: fun()): lest.Mock
Creates a new mock function, optionally giving it an implementation if passed.
local mockFn = lest.fn()
mockFn()
expect(mockFn).toHaveBeenCalled()
-- With a mock implementation:
local returnsTrue = lest.fn(function() return true end)
print(returnsTrue()) -- true