return function()local G=require(script.Parent.findWhereLast)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\104\101 \108\097\115\116 \101\108\101\109\101\110\116 \116\104\097\116 \109\097\116\099\104\101\115 \116\104\101 \112\114\101\100\105\099\097\116\101",function()local j={1;2;3;4,5};(expect(G(j,function(G)return G%2==0 end))).to.equal(4)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 \112\114\101\100\105\099\097\116\101",function()local j={1,2,3;4,5};(expect(G(j,function(G)return G==6 end))).never.to.be.ok()end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\104\101 \108\097\115\116 \101\108\101\109\101\110\116 \116\104\097\116 \109\097\116\099\104\101\115 \116\104\101 \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 j={1;2,3;4;5};(expect(G(j,function(G)return G%2==0 end,2))).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 \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 j={1;2,3,4;5};(expect(G(j,function(G)return G==4 end,3))).never.to.be.ok()end)end
return function()
	local FindWhereLast = require(script.Parent.findWhereLast)

	it("should return the last element that matches the predicate", function()
		local array = { 1, 2, 3, 4, 5 }

		expect(FindWhereLast(array, function(value)
			return value % 2 == 0
		end)).to.equal(4)
	end)

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

		expect(FindWhereLast(array, function(value)
			return value == 6
		end)).never.to.be.ok()
	end)

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

		expect(FindWhereLast(array, function(value)
			return value % 2 == 0
		end, 2)).to.equal(2)
	end)

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

		expect(FindWhereLast(array, function(value)
			return value == 4
		end, 3)).never.to.be.ok()
	end)
end
