return function()local O=require(script.Parent.Store)local Z=require(script.Parent.thunkMiddleware)it("\115\104\111\117\108\100 \100\105\115\112\097\116\099\104 \116\104\117\110\107\115",function()local function p(O,Z)return O end local j=O.new(p,{},{Z})local N=0 local function T(O)N=N+1 end j:dispatch(T);(expect(N)).to.equal(1)end)it("\115\104\111\117\108\100 \097\108\108\111\119 \110\111\114\109\097\108 \097\099\116\105\111\110\115 \116\111 \112\097\115\115 \116\104\114\111\117\103\104",function()local p=0 local function j(O,Z)p=p+1 return O end local N=O.new(j,{},{Z})N:dispatch({type="\116\101\115\116"});(expect(p)).to.equal(2)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\104\101 \118\097\108\117\101 \102\114\111\109 \116\104\101 \116\104\117\110\107",function()local function p(O,Z)return O end local j=O.new(p,{},{Z})local N="\116\101\115\116"local function T(O)return N end local c=j:dispatch(T);(expect(c)).to.equal(N)end)end
return function()
	local Store = require(script.Parent.Store)
	local thunkMiddleware = require(script.Parent.thunkMiddleware)

	it("should dispatch thunks", function()
		local function reducer(state, action)
			return state
		end

		local store = Store.new(reducer, {}, { thunkMiddleware })
		local thunkCount = 0

		local function thunk(store)
			thunkCount = thunkCount + 1
		end

		store:dispatch(thunk)

		expect(thunkCount).to.equal(1)
	end)

	it("should allow normal actions to pass through", function()
		local reducerCount = 0

		local function reducer(state, action)
			reducerCount = reducerCount + 1
			return state
		end

		local store = Store.new(reducer, {}, { thunkMiddleware })

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

		-- Reducer will be invoked twice:
		-- Once when creating the store (@@INIT action)
		-- Once when the test action is dispatched
		expect(reducerCount).to.equal(2)
	end)

	it("should return the value from the thunk", function()
		local function reducer(state, action)
			return state
		end

		local store = Store.new(reducer, {}, { thunkMiddleware })
		local thunkValue = "test"

		local function thunk(store)
			return thunkValue
		end

		local result = store:dispatch(thunk)

		expect(result).to.equal(thunkValue)
	end)
end
