return function()local O=script.Parent local Z=O.Parent local H=Z.Parent local g=(require(H.Dev.JestGlobals)).expect local D=require(Z.getUnique)local Q=require(O.InstanceSetup)local w=nil local R=nil afterEach(function()if R then R()R=nil end end)it("\114\101\116\117\114\110\115 \116\104\101 \105\110\115\116\097\110\099\101 \116\097\103\103\101\100 \119\105\116\104 \096\111\111\102\096",function()w,R=Q.create({oof={"\111\111\102"}});(g(D("\111\111\102"))).toBe(w.oof)end)it("\114\101\116\117\114\110\115 \116\104\101 \105\110\115\116\097\110\099\101 \116\097\103\103\101\100 \119\105\116\104 \096\108\105\110\107\096 \097\110\100 \096\116\111\111\108\116\105\112\096",function()w,R=Q.create({button={"\108\105\110\107"},tooltipButton={"\108\105\110\107";"\116\111\111\108\116\105\112"}});(g(D("\108\105\110\107","\116\111\111\108\116\105\112"))).toBe(w.tooltipButton)end)it("\116\104\114\111\119\115 \105\102 \116\104\101\114\101 \105\115 \109\111\114\101 \116\104\097\110 \111\110\101 \105\110\115\116\097\110\099\101 \116\097\103\103\101\100 \119\105\116\104 \096\111\111\102\096",function()w,R=Q.create({oof={"\111\111\102"},otherOof={"\111\111\102"}});(g(function()D("\111\111\102")end)).toThrow("\101\120\112\101\099\116\101\100 \116\111 \102\105\110\100 \111\110\108\121 \111\110\101 \105\110\115\116\097\110\099\101 \116\097\103\103\101\100 \119\105\116\104 \111\111\102\044 \098\117\116 \102\111\117\110\100 \050")end)it("\116\104\114\111\119\115 \105\102 \116\104\101\114\101 \105\115 \110\111 \105\110\115\116\097\110\099\101\115 \116\097\103\103\101\100 \119\105\116\104 \096\111\111\102\096",function()w,R=Q.create({button={"\098\117\116\116\111\110"}});(g(function()D("\111\111\102")end)).toThrow("\117\110\097\098\108\101 \116\111 \102\105\110\100 \105\110\115\116\097\110\099\101 \116\097\103\103\101\100 \119\105\116\104 \111\111\102")end)end
return function()
	local tests = script.Parent
	local root = tests.Parent
	local Packages = root.Parent

	local expect = require(Packages.Dev.JestGlobals).expect
	local getUnique = require(root.getUnique)

	local InstanceSetup = require(tests.InstanceSetup)

	local instances = nil
	local cleanInstances = nil

	afterEach(function()
		if cleanInstances then
			cleanInstances()
			cleanInstances = nil
		end
	end)

	it("returns the instance tagged with `oof`", function()
		instances, cleanInstances = InstanceSetup.create({
			oof = { "oof" },
		})
		expect(getUnique("oof")).toBe(instances.oof)
	end)

	it("returns the instance tagged with `link` and `tooltip`", function()
		instances, cleanInstances = InstanceSetup.create({
			button = { "link" },
			tooltipButton = { "link", "tooltip" },
		})
		expect(getUnique("link", "tooltip")).toBe(instances.tooltipButton)
	end)

	it("throws if there is more than one instance tagged with `oof`", function()
		instances, cleanInstances = InstanceSetup.create({
			oof = { "oof" },
			otherOof = { "oof" },
		})
		expect(function()
			getUnique("oof")
		end).toThrow("expected to find only one instance tagged with oof, but found 2")
	end)

	it("throws if there is no instances tagged with `oof`", function()
		instances, cleanInstances = InstanceSetup.create({
			button = { "button" },
		})
		expect(function()
			getUnique("oof")
		end).toThrow("unable to find instance tagged with oof")
	end)
end
