return function()local E=require(script.Parent.update)it("\115\104\111\117\108\100 \117\112\100\097\116\101 \116\104\101 \118\097\108\117\101 \097\116 \116\104\101 \103\105\118\101\110 \105\110\100\101\120",function()local R={1;2,3}local f=E(R,2,function(E)return E+1 end);(expect(f)).to.be.a("\116\097\098\108\101");(expect(#f)).to.equal(3);(expect(f[1])).to.equal(1);(expect(f[2])).to.equal(3);(expect(f[3])).to.equal(3)end)it("\115\104\111\117\108\100 \099\114\101\097\116\101 \118\097\108\117\101\115 \117\115\105\110\103 \116\104\101 \099\097\108\108\098\097\099\107",function()local R={1,2;3}local f=E(R,4,function(E)return E+1 end,function()return 5 end);(expect(f)).to.be.a("\116\097\098\108\101");(expect(#f)).to.equal(4);(expect(f[1])).to.equal(1);(expect(f[2])).to.equal(2);(expect(f[3])).to.equal(3);(expect(f[4])).to.equal(5)end)it("\115\104\111\117\108\100 \110\111\116 \109\111\100\105\102\121 \116\104\101 \111\114\105\103\105\110\097\108 \097\114\114\097\121",function()local R={1,2;3}E(R,2,function(E)return E+1 end);(expect(R[1])).to.equal(1);(expect(R[2])).to.equal(2);(expect(R[3])).to.equal(3)end)end
return function()
	local Update = require(script.Parent.update)

	it("should update the value at the given index", function()
		local array = { 1, 2, 3 }

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

		expect(result).to.be.a("table")
		expect(#result).to.equal(3)

		expect(result[1]).to.equal(1)
		expect(result[2]).to.equal(3)
		expect(result[3]).to.equal(3)
	end)

	it("should create values using the callback", function()
		local array = { 1, 2, 3 }

		local result = Update(array, 4, function(value)
			return value + 1
		end, function()
			return 5
		end)

		expect(result).to.be.a("table")
		expect(#result).to.equal(4)

		expect(result[1]).to.equal(1)
		expect(result[2]).to.equal(2)
		expect(result[3]).to.equal(3)
		expect(result[4]).to.equal(5)
	end)

	it("should not modify the original array", function()
		local array = { 1, 2, 3 }

		Update(array, 2, function(value)
			return value + 1
		end)

		expect(array[1]).to.equal(1)
		expect(array[2]).to.equal(2)
		expect(array[3]).to.equal(3)
	end)
end
