return function()local D=require(script.Parent.createSpy)describe("\099\114\101\097\116\101\083\112\121",function()it("\115\104\111\117\108\100 \099\114\101\097\116\101 \115\112\105\101\115",function()local F=D(function() end);(expect(F)).to.be.ok()end)it("\115\104\111\117\108\100 \116\104\114\111\119 \105\102 \115\112\105\101\115 \097\114\101 \105\110\100\101\120\101\100 \098\121 \097\110 \105\110\118\097\108\105\100 \107\101\121",function()local F=D(function() end);(expect(function()return F.test end)).to.throw()end)end)describe("\118\097\108\117\101",function()it("\115\104\111\117\108\100 \105\110\099\114\101\109\101\110\116 \099\097\108\108\067\111\117\110\116 \119\104\101\110 \099\097\108\108\101\100",function()local F=D(function() end)F.value();(expect(F.callCount)).to.equal(1)end)it("\115\104\111\117\108\100 \115\116\111\114\101 \097\108\108 \118\097\108\117\101\115 \112\097\115\115\101\100",function()local F=D(function() end)F.value(1,true,"\051");(expect(F.valuesLength)).to.equal(3);(expect(F.values[1])).to.equal(1);(expect(F.values[2])).to.equal(true);(expect(F.values[3])).to.equal("\051")end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\104\101 \118\097\108\117\101 \111\102 \116\104\101 \105\110\110\101\114 \102\117\110\099\116\105\111\110",function()local F=D(function()return true end);(expect(F.value())).to.equal(true)end)end)describe("\097\115\115\101\114\116\067\097\108\108\101\100\087\105\116\104",function()it("\115\104\111\117\108\100 \116\104\114\111\119 \105\102 \116\104\101 \110\117\109\098\101\114 \111\102 \118\097\108\117\101\115 \100\105\102\102\101\114\115",function()local F=D(function() end)F.value(1,2);(expect(function()F:assertCalledWith(1)end)).to.throw()end)it("\115\104\111\117\108\100 \116\104\114\111\119 \105\102 \097\110\121 \118\097\108\117\101 \100\105\102\102\101\114\115",function()local F=D(function() end)F.value(1,2);(expect(function()F:assertCalledWith(1,3)end)).to.throw();(expect(function()F:assertCalledWith(2,3)end)).to.throw()end)end)describe("\099\097\112\116\117\114\101\086\097\108\117\101\115",function()it("\115\104\111\117\108\100 \116\104\114\111\119 \105\102 \116\104\101 \110\117\109\098\101\114 \111\102 \118\097\108\117\101\115 \100\105\102\102\101\114\115",function()local F=D(function() end)F.value(1,2);(expect(function()F:captureValues("\097")end)).to.throw()end)it("\115\104\111\117\108\100 \099\097\112\116\117\114\101 \097\108\108 \118\097\108\117\101\115 \105\110 \097 \116\097\098\108\101",function()local F=D(function() end)F.value(1,2)local t=F:captureValues("\097","\098");(expect(t.a)).to.equal(1);(expect(t.b)).to.equal(2)end)end)end
return function()
	local createSpy = require(script.Parent.createSpy)

	describe("createSpy", function()
		it("should create spies", function()
			local spy = createSpy(function() end)

			expect(spy).to.be.ok()
		end)

		it("should throw if spies are indexed by an invalid key", function()
			local spy = createSpy(function() end)

			expect(function()
				return spy.test
			end).to.throw()
		end)
	end)

	describe("value", function()
		it("should increment callCount when called", function()
			local spy = createSpy(function() end)
			spy.value()

			expect(spy.callCount).to.equal(1)
		end)

		it("should store all values passed", function()
			local spy = createSpy(function() end)
			spy.value(1, true, "3")

			expect(spy.valuesLength).to.equal(3)
			expect(spy.values[1]).to.equal(1)
			expect(spy.values[2]).to.equal(true)
			expect(spy.values[3]).to.equal("3")
		end)

		it("should return the value of the inner function", function()
			local spy = createSpy(function()
				return true
			end)

			expect(spy.value()).to.equal(true)
		end)
	end)

	describe("assertCalledWith", function()
		it("should throw if the number of values differs", function()
			local spy = createSpy(function() end)
			spy.value(1, 2)

			expect(function()
				spy:assertCalledWith(1)
			end).to.throw()
		end)

		it("should throw if any value differs", function()
			local spy = createSpy(function() end)
			spy.value(1, 2)

			expect(function()
				spy:assertCalledWith(1, 3)
			end).to.throw()

			expect(function()
				spy:assertCalledWith(2, 3)
			end).to.throw()
		end)
	end)

	describe("captureValues", function()
		it("should throw if the number of values differs", function()
			local spy = createSpy(function() end)
			spy.value(1, 2)

			expect(function()
				spy:captureValues("a")
			end).to.throw()
		end)

		it("should capture all values in a table", function()
			local spy = createSpy(function() end)
			spy.value(1, 2)

			local captured = spy:captureValues("a", "b")
			expect(captured.a).to.equal(1)
			expect(captured.b).to.equal(2)
		end)
	end)
end