return function()local b=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local Q=b.Packages local o=require(Q.Llama)local F=o.Dictionary local O=F.map it("\115\104\111\117\108\100 \118\097\108\105\100\097\116\101 \116\121\112\101\115",function()local b={{0},{{};0},{0,function() end}}for Q=1,#b,1 do local o,F=pcall(function()O(unpack(b[Q]))end);(expect(string.find(F,"\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 b={}local function Q(b)return b end;(expect(O(b,Q))).never.to.equal(b)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 b={foo=1;bar=2,baz=3}local Q=0 setmetatable(b,{__newindex=function()Q=Q+1 end})local function o(b)return b end O(b,o);(expect(Q)).to.equal(0)end)it("\115\104\111\117\108\100 \099\097\108\108 \116\104\101 \099\097\108\108\098\097\099\107 \102\111\114 \101\097\099\104 \101\108\101\109\101\110\116",function()local b={foo=1,bar=2,baz=3}local Q={}local function o(b,o)Q[o]=b return b end O(b,o)for b,o in pairs(b)do(expect(Q[b])).to.equal(o)end for Q,o in pairs(Q)do(expect(o)).to.equal(b[Q])end end)it("\115\104\111\117\108\100 \115\101\116 \116\104\101 \110\101\119 \118\097\108\117\101\115 \116\111 \116\104\101 \102\105\114\115\116 \114\101\115\117\108\116 \111\102 \116\104\101 \103\105\118\101\110 \099\097\108\108\098\097\099\107",function()local b={foo=1,bar=2,baz=3}local function Q(b)return b*2 end local o=O(b,Q)for o,F in pairs(o)do(expect(Q(b[o]))).to.equal(F)end end)it("\115\104\111\117\108\100 \115\101\116 \116\104\101 \110\101\119 \107\101\121\115 \116\111 \116\104\101 \115\101\099\111\110\100 \114\101\115\117\108\116 \111\102 \116\104\101 \103\105\118\101\110 \099\097\108\108\098\097\099\107",function()local b={foo=1,bar=2;baz=3}local function Q(b,Q)return b,Q.."\098\097\114"end local o=O(b,Q)for b,Q in pairs(b)do(expect(o[b.."\098\097\114"])).to.equal(Q);(expect(o[b])).never.to.be.ok()end end)it("\115\104\111\117\108\100 \114\101\109\111\118\101 \118\097\108\117\101\115 \119\104\101\110 \110\105\108 \105\115 \114\101\116\117\114\110\101\100",function()local b={foo=1;bar=2;baz=3}local function Q()return nil end local o=O(b,Q);(expect(next(o,nil))).never.to.be.ok()end)it("\115\104\111\117\108\100 \119\111\114\107 \119\105\116\104 \097\110 \101\109\112\116\121 \108\105\115\116",function()local b={}local Q=O(b,function() end);(expect(Q)).to.be.a("\116\097\098\108\101");(expect(Q)).never.to.equal(b)end)end
return function()
	local ReplicatedStorage = game:GetService("ReplicatedStorage")

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

	local Dictionary = Llama.Dictionary
	local map = Dictionary.map

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

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

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

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

		local function doNothing(v)
			return v
		end

		expect(map(a, doNothing)).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,
		})

		local function doNothing(v)
			return v
		end

		map(a, doNothing)

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

	it("should call the callback for each element", function()
		local a = {
			foo = 1, 
			bar = 2, 
			baz = 3,
		}
		local copy = {}

		local function copier(v, k)
			copy[k] = v
			return v
		end

		map(a, copier)

		for k, v in pairs(a) do
			expect(copy[k]).to.equal(v)
		end

		for k, v in pairs(copy) do
			expect(v).to.equal(a[k])
		end
	end)

	it("should set the new values to the first result of the given callback", function()
		local a = {
			foo = 1, 
			bar = 2, 
			baz = 3,
		}

		local function double(v)
			return v * 2
		end

		local b = map(a, double)

		for k, v in pairs(b) do
			expect(double(a[k])).to.equal(v)
		end
	end)

	it("should set the new keys to the second result of the given callback", function()
		local a = {
			foo = 1, 
			bar = 2, 
			baz = 3,
		}

		local function barify(v, k)
			return v, k .. "bar"
		end

		local b = map(a, barify)

		for k, v in pairs(a) do
			expect(b[k .. "bar"]).to.equal(v)
			expect(b[k]).never.to.be.ok()
		end
	end)

	it("should remove values when nil is returned", function()
		local a = {
			foo = 1, 
			bar = 2, 
			baz = 3,
		}

		local function nothing()
			return nil
		end

		local b = map(a, nothing)

		expect(next(b, nil)).never.to.be.ok()
	end)

	it("should work with an empty list", function()
		local a = {}
		local b = map(a, function() end)

		expect(b).to.be.a("table")
		expect(b).never.to.equal(a)
	end)
end