return function()local g=require(script.Parent.findWhere)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\104\101 \102\105\114\115\116 \101\108\101\109\101\110\116 \105\110 \116\104\101 \097\114\114\097\121 \116\104\097\116 \109\097\116\099\104\101\115 \116\104\101 \103\105\118\101\110 \112\114\101\100\105\099\097\116\101",function()local X={1;2;3}local G=g(X,function(g)return g==2 end);(expect(G)).to.equal(2)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \110\105\108 \105\102 \110\111 \101\108\101\109\101\110\116 \109\097\116\099\104\101\115 \116\104\101 \103\105\118\101\110 \112\114\101\100\105\099\097\116\101",function()local X={1;2;3}local G=g(X,function(g)return g==4 end);(expect(G)).never.to.be.ok()end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\104\101 \102\105\114\115\116 \101\108\101\109\101\110\116 \105\110 \116\104\101 \097\114\114\097\121 \116\104\097\116 \109\097\116\099\104\101\115 \116\104\101 \103\105\118\101\110 \112\114\101\100\105\099\097\116\101\044 \103\105\118\101\110 \097 \115\116\097\114\116\105\110\103 \105\110\100\101\120",function()local X={1,2,3}local G=g(X,function(g)return g==3 end,2);(expect(G)).to.equal(3)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \110\105\108 \105\102 \110\111 \101\108\101\109\101\110\116 \109\097\116\099\104\101\115 \116\104\101 \103\105\118\101\110 \112\114\101\100\105\099\097\116\101\044 \103\105\118\101\110 \097 \115\116\097\114\116\105\110\103 \105\110\100\101\120",function()local X={1,2;3}local G=g(X,function(g)return g==1 end,2);(expect(G)).never.to.be.ok()end)end
return function()
	local FindWhere = require(script.Parent.findWhere)

	it("should return the first element in the array that matches the given predicate", function()
		local array = { 1, 2, 3 }

		local result = FindWhere(array, function(value)
			return value == 2
		end)

		expect(result).to.equal(2)
	end)

	it("should return nil if no element matches the given predicate", function()
		local array = { 1, 2, 3 }

		local result = FindWhere(array, function(value)
			return value == 4
		end)

		expect(result).never.to.be.ok()
	end)

	it(
		"should return the first element in the array that matches the given predicate, given a starting index",
		function()
			local array = { 1, 2, 3 }

			local result = FindWhere(array, function(value)
				return value == 3
			end, 2)

			expect(result).to.equal(3)
		end
	)

	it("should return nil if no element matches the given predicate, given a starting index", function()
		local array = { 1, 2, 3 }

		local result = FindWhere(array, function(value)
			return value == 1
		end, 2)

		expect(result).never.to.be.ok()
	end)
end
