-- ROBLOX TODO: type as fn(implementation: (...) -> any): JestMock.Mock<any, any> once ... syntax is supported

function ModuleMockerClass:fn(implementation)
	local length = 0
	local fn = self:_makeComponent({ length = length, type = "function" })
	if implementation then
		fn.mockImplementation(implementation)
	end

	-- ROBLOX deviation: fn is a callable table,
	-- return a forwarding function as the second return value
	local function mockFn(...)
		return getmetatable(fn).__call(fn, ...)
	end

	return fn, mockFn
end

function ModuleMockerClass:clearAllMocks()
	self._mockState = {}
end

function ModuleMockerClass:resetAllMocks()
	self._mockConfigRegistry = {}
	self._mockState = {}
end

function ModuleMockerClass:restoreAllMocks()
	for key, value in ipairs(self._spyState) do
		key()
	end
	self._spyState = Set.new()
end
