return function()local i=require(script.Parent.update)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097 \110\101\119 \100\105\099\116\105\111\110\097\114\121 \119\105\116\104 \116\104\101 \103\105\118\101\110 \107\101\121 \117\112\100\097\116\101\100",function()local R={cats=2}local o=i(R,"\099\097\116\115",function(i)return i+1 end);(expect(o)).to.be.a("\116\097\098\108\101");(expect(o.cats)).to.equal(3)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 \100\105\099\116\105\111\110\097\114\121",function()local R={cats=2}i(R,"\099\097\116\115",function(i)return i+1 end)i(R,"\100\111\103\115",nil,function()return 1 end);(expect(R)).to.be.a("\116\097\098\108\101");(expect(R.cats)).to.equal(2);(expect(R.dogs)).to.equal(nil)end)it("\115\104\111\117\108\100 \099\114\101\097\116\101 \116\104\101 \107\101\121 \105\102 \105\116 \100\111\101\115 \110\111\116 \101\120\105\115\116",function()local R={cats=2}local o=i(R,"\100\111\103\115",function(i)return i+1 end,function()return 1 end);(expect(o)).to.be.a("\116\097\098\108\101");(expect(o.cats)).to.equal(2);(expect(o.dogs)).to.equal(1)end)it("\115\104\111\117\108\100 \110\111\116 \099\114\101\097\116\101 \097 \107\101\121 \105\102 \105\116 \100\111\101\115\110\'\116 \101\120\105\115\116 \097\110\100 \110\111 \099\097\108\108\098\097\099\107 \105\115 \115\112\101\099\105\102\105\101\100",function()local R={cats=2}local o=i(R,"\100\111\103\115",function()return 1 end);(expect(o.dogs)).to.equal(nil)end)end
return function()
	local Update = require(script.Parent.update)

	it("should return a new dictionary with the given key updated", function()
		local dictionary = { cats = 2 }

		local new = Update(dictionary, "cats", function(value)
			return value + 1
		end)

		expect(new).to.be.a("table")

		expect(new.cats).to.equal(3)
	end)

	it("should not modify the original dictionary", function()
		local dictionary = { cats = 2 }

		Update(dictionary, "cats", function(value)
			return value + 1
		end)

		Update(dictionary, "dogs", nil, function()
			return 1
		end)

		expect(dictionary).to.be.a("table")

		expect(dictionary.cats).to.equal(2)
		expect(dictionary.dogs).to.equal(nil)
	end)

	it("should create the key if it does not exist", function()
		local dictionary = { cats = 2 }

		local new = Update(dictionary, "dogs", function(value)
			return value + 1
		end, function()
			return 1
		end)

		expect(new).to.be.a("table")

		expect(new.cats).to.equal(2)
		expect(new.dogs).to.equal(1)
	end)

	it("should not create a key if it doesn't exist and no callback is specified", function()
		local dictionary = { cats = 2 }

		local new = Update(dictionary, "dogs", function()
			return 1
		end)

		expect(new.dogs).to.equal(nil)
	end)
end
