local h=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local C=require(script.Parent.FindUp)local A=h.TestTarget:FindFirstChild("\084\104\105\110\103\050",true)return function()it("\115\104\111\117\108\100 \102\105\110\100 \116\104\101 \099\111\114\114\101\099\116 \111\098\106\101\099\116",function()(expect(C(A,"\084\104\105\110\103\049"))).to.be.ok();(expect(C(A,"\082\111\097\099\116"))).to.be.ok()end)it("\115\104\111\117\108\100 \102\105\110\100 \116\104\101 \099\111\114\114\101\099\116 \111\098\106\101\099\116 \040\099\108\097\115\115\078\097\109\101\041",function()local h=C(A,"\083\101\110\100\077\111\110\101\121",{className="\082\101\109\111\116\101\070\117\110\099\116\105\111\110"})local t=C(A,"\083\101\110\100\077\111\110\101\121",{className="\082\101\109\111\116\101\069\118\101\110\116"});(expect(h)).to.be.ok();(expect(t)).to.be.ok();(expect(h.ClassName)).to.equal("\082\101\109\111\116\101\070\117\110\099\116\105\111\110");(expect(t.ClassName)).to.equal("\082\101\109\111\116\101\069\118\101\110\116")end)it("\115\104\111\117\108\100 \102\105\110\100 \116\104\101 \099\111\114\114\101\099\116 \111\098\106\101\099\116 \040\105\115\065\041",function()(expect(C(A,"\068\111\084\104\105\110\103",{isA="\086\097\108\117\101\066\097\115\101"}))).to.be.ok()end)it("\115\104\111\117\108\100 \102\105\110\100 \116\104\101 \099\111\114\114\101\099\116 \111\098\106\101\099\116 \040\105\103\110\111\114\101\067\097\115\101\041",function()(expect(C(A,"\114\111\097\099\116",{ignoreCase=true}))).to.be.ok()end)it("\115\104\111\117\108\100 \102\105\110\100 \116\104\101 \099\111\114\114\101\099\116 \111\098\106\101\099\116 \040\112\114\101\100\105\099\097\116\101\041",function()(expect(C(A,"\115\101\110\100\109\111\110\101\121",{ignoreCase=true;predicate=function(h)return h.ClassName=="\082\101\109\111\116\101\069\118\101\110\116"end}))).to.be.ok()end)it("\115\104\111\117\108\100 \115\116\111\112 \097\116 \116\104\101 \103\105\118\101\110 \115\116\111\112\065\116 \112\111\105\110\116",function()(expect(C(A,"\083\101\110\100\077\111\110\101\121",{stopAt=A.Parent}))).to.equal(nil)end)end
--!strict
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local FindUp = require(script.Parent.FindUp)

local TestRoot = ReplicatedStorage.TestTarget:FindFirstChild("Thing2", true)

return function()
	it("should find the correct object", function()
		expect(FindUp(TestRoot, "Thing1")).to.be.ok()
		expect(FindUp(TestRoot, "Roact")).to.be.ok()
	end)

	it("should find the correct object (className)", function()
		local func = FindUp(TestRoot, "SendMoney", { className = "RemoteFunction" })
		local evt = FindUp(TestRoot, "SendMoney", { className = "RemoteEvent" })

		expect(func).to.be.ok()
		expect(evt).to.be.ok()

		expect(func.ClassName).to.equal("RemoteFunction")
		expect(evt.ClassName).to.equal("RemoteEvent")
	end)

	it("should find the correct object (isA)", function()
		expect(FindUp(TestRoot, "DoThing", { isA = "ValueBase" })).to.be.ok()
	end)

	it("should find the correct object (ignoreCase)", function()
		expect(FindUp(TestRoot, "roact", { ignoreCase = true })).to.be.ok()
	end)

	it("should find the correct object (predicate)", function()
		expect(FindUp(TestRoot, "sendmoney", {
			ignoreCase = true,
			predicate = function(object)
				return object.ClassName == "RemoteEvent"
			end,
		})).to.be.ok()
	end)

	it("should stop at the given stopAt point", function()
		expect(FindUp(TestRoot, "SendMoney", { stopAt = TestRoot.Parent })).to.equal(nil)
	end)
end
