return function()local O=require(script.Parent.Store)local Z=require(script.Parent.loggerMiddleware)it("\115\104\111\117\108\100 \112\114\105\110\116 \119\104\101\110\101\118\101\114 \097\110 \097\099\116\105\111\110 \105\115 \100\105\115\112\097\116\099\104\101\100",function()local p=0 local j local function N(O,Z)return O end local T=O.new(N,{fooValue=12345,barValue={bazValue="\104\105\066\097\122"}},{Z.middleware})Z.outputFunction=function(O)p=p+1 j=O end T:dispatch({type="\116\101\115\116\065\099\116\105\111\110\084\121\112\101"});(expect(p)).to.equal(1);(expect(j:find("\116\101\115\116\065\099\116\105\111\110\084\121\112\101"))).to.be.ok();(expect(j:find("\102\111\111\086\097\108\117\101"))).to.be.ok();(expect(j:find("\049\050\051\052\053"))).to.be.ok();(expect(j:find("\098\097\114\086\097\108\117\101"))).to.be.ok();(expect(j:find("\098\097\122\086\097\108\117\101"))).to.be.ok();(expect(j:find("\104\105\066\097\122"))).to.be.ok()Z.outputFunction=print end)end
return function()
	local Store = require(script.Parent.Store)
	local loggerMiddleware = require(script.Parent.loggerMiddleware)

	it("should print whenever an action is dispatched", function()
		local outputCount = 0
		local outputMessage

		local function reducer(state, action)
			return state
		end

		local store = Store.new(reducer, {
			fooValue = 12345,
			barValue = {
				bazValue = "hiBaz",
			},
		}, { loggerMiddleware.middleware })

		loggerMiddleware.outputFunction = function(message)
			outputCount = outputCount + 1
			outputMessage = message
		end

		store:dispatch({
			type = "testActionType",
		})

		expect(outputCount).to.equal(1)
		expect(outputMessage:find("testActionType")).to.be.ok()
		expect(outputMessage:find("fooValue")).to.be.ok()
		expect(outputMessage:find("12345")).to.be.ok()
		expect(outputMessage:find("barValue")).to.be.ok()
		expect(outputMessage:find("bazValue")).to.be.ok()
		expect(outputMessage:find("hiBaz")).to.be.ok()

		loggerMiddleware.outputFunction = print
	end)
end
