return function()local v=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local h=v.Packages local B=require(h.Llama)local k=B.Dictionary local c=k.update it("\115\104\111\117\108\100 \118\097\108\105\100\097\116\101 \116\121\112\101\115",function()local v={{0};{0;0}}for h=1,#v,1 do local B,k=pcall(function()c(unpack(v[h]))end);(expect(string.find(k,"\101\120\112\101\099\116\101\100\044 \103\111\116"))).to.be.ok()end end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097 \110\101\119 \116\097\098\108\101",function()local v={};(expect(c(v,"\102\111\111"))).never.to.equal(v)end)it("\115\104\111\117\108\100 \110\111\116 \109\117\116\097\116\101 \112\097\115\115\101\100 \105\110 \116\097\098\108\101\115",function()local v={foo=1,bar=2,baz=3}local h=0 setmetatable(v,{__newindex=function()h=h+1 end})c(v,"\102\111\111");(expect(h)).to.equal(0)end)it("\115\104\111\117\108\100 \117\112\100\097\116\101 \118\097\108\117\101 \097\116 \115\112\101\099\105\102\105\101\100 \107\101\121",function()local v={foo=1,bar=2}local function h(v)return v*2 end local B=c(v,"\098\097\114",h);(expect(B.bar)).to.equal(h(v.bar))end)it("\115\104\111\117\108\100 \099\097\108\108 \099\097\108\108\098\097\099\107 \105\102 \107\101\121 \100\111\101\115 \110\111\116 \101\120\105\115\116 \097\110\100 \099\114\101\097\116\101 \101\110\116\114\121 \105\102 \112\114\111\118\105\100\101\100",function()local v={foo=1;bar=2}local h=c(v,"\098\097\122",nil,function()return 3 end);(expect(h.baz)).to.equal(3)end)it("\115\104\111\117\108\100 \112\097\115\115 \107\101\121 \097\110\100 \118\097\108\117\101 \116\111 \117\112\100\097\116\101 \097\110\100 \099\097\108\108\098\097\099\107",function()local v={foo=1,bar=2}c(v,"\098\097\114",function(v,h)(expect(v)).to.equal(2);(expect(h)).to.equal("\098\097\114")end)c(v,"\098\097\122",nil,function(v)(expect(v)).to.equal("\098\097\122")end)end)end
return function()
	local ReplicatedStorage = game:GetService("ReplicatedStorage")

	local Packages = ReplicatedStorage.Packages
	local Llama = require(Packages.Llama)

	local Dictionary = Llama.Dictionary
	local update = Dictionary.update

	it("should validate types", function()
		local args = {
			{ 0 },
			{ 0, 0 },
		}

		for i = 1, #args do
			local _, err = pcall(function()
				update(unpack(args[i]))
			end)

			expect(string.find(err, "expected, got")).to.be.ok()
		end
	end)

	it("should return a new table", function()
		local a = {}

		expect(update(a, "foo")).never.to.equal(a)
	end)

	it("should not mutate passed in tables", function()
		local a = {
			foo = 1,
			bar = 2,
			baz = 3,
		}
		local mutations = 0

		setmetatable(a, {
			__newindex = function()
				mutations = mutations + 1
			end,
		})

		update(a, "foo")

		expect(mutations).to.equal(0)
	end)

	it("should update value at specified key", function()
		local a = {
			foo = 1,
			bar = 2,
		}

		local function double(v)
			return v * 2
		end

		local b = update(a, "bar", double)

		expect(b.bar).to.equal(double(a.bar))
	end)

	it("should call callback if key does not exist and create entry if provided", function()
		local a = {
			foo = 1,
			bar = 2,
		}

		local b = update(a, "baz", nil, function()
			return 3
		end)

		expect(b.baz).to.equal(3)
	end)

	it("should pass key and value to update and callback", function()
		local a = {
			foo = 1,
			bar = 2,
		}

		update(a, "bar", function(value, key)
			expect(value).to.equal(2)
			expect(key).to.equal("bar")
		end)

		update(a, "baz", nil, function(key)
			expect(key).to.equal("baz")
		end)
	end)
end