return function()local Q=require(script.Parent.Draft)local n=require(script.Parent.finishDraft)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\104\101 \103\105\118\101\110 \118\097\108\117\101 \119\104\101\110 \105\116 \105\115 \110\111\116 \097 \100\114\097\102\116",function()local Q={};(expect(n(Q))).to.equal(Q);(expect(n(1))).to.equal(1);(expect(n("\102\111\111"))).to.equal("\102\111\111");(expect(n(false))).to.equal(false);(expect(n(nil))).to.equal(nil)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\104\101 \111\114\105\103\105\110\097\108 \116\097\098\108\101 \119\104\101\110 \116\104\101 \103\105\118\101\110 \100\114\097\102\116 \119\097\115 \110\111\116 \109\111\100\105\102\105\101\100",function()local u={foo=true}local y=Q.new(u)local V=n(y);(expect(V)).to.equal(u)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097 \110\101\119 \116\097\098\108\101 \119\104\101\110 \116\104\101 \103\105\118\101\110 \100\114\097\102\116 \119\097\115 \109\111\100\105\102\105\101\100",function()local u={foo=true}local y=Q.new(u)y.bar=true local V=n(y);(expect(V)).to.never.equal(u);(expect(V.foo)).to.equal(true);(expect(V.bar)).to.equal(true)end)it("\115\104\111\117\108\100 \110\111\116 \109\117\116\097\116\101 \110\111\110-\100\114\097\102\116 \116\097\098\108\101\115",function()local Q=table.freeze({foo=true});(expect(function()n(Q)end)).to.never.throw()end)end
return function()
	local Draft = require(script.Parent.Draft)
	local finishDraft = require(script.Parent.finishDraft)

	it("should return the given value when it is not a draft", function()
		local base = {}
		expect(finishDraft(base)).to.equal(base)
		expect(finishDraft(1)).to.equal(1)
		expect(finishDraft("foo")).to.equal("foo")
		expect(finishDraft(false)).to.equal(false)
		expect(finishDraft(nil)).to.equal(nil)
	end)

	it("should return the original table when the given draft was not modified", function()
		local original = { foo = true }

		local draft = Draft.new(original)

		local finished = finishDraft(draft)

		expect(finished).to.equal(original)
	end)

	it("should return a new table when the given draft was modified", function()
		local original = { foo = true }

		local draft = Draft.new(original)
		draft.bar = true

		local finished = finishDraft(draft)
		expect(finished).to.never.equal(original)
		expect(finished.foo).to.equal(true)
		expect(finished.bar).to.equal(true)
	end)

	it("should not mutate non-draft tables", function()
		local original = table.freeze({ foo = true })

		expect(function()
			finishDraft(original)
		end).to.never.throw()
	end)
end
