Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
assert that state/props are correctly passed
Browse files Browse the repository at this point in the history
  • Loading branch information
AmaranthineCodices committed Mar 5, 2018
1 parent 48e09d6 commit 632dbcb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/Component.spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ return function()

it("should invoke functions to compute a partial state", function()
local TestComponent = Component:extend("TestComponent")
local setStateCallback, getStateCallback
local setStateCallback, getStateCallback, getPropsCallback

function TestComponent:init()
setStateCallback = function(newState)
Expand All @@ -340,6 +340,10 @@ return function()
return self.state
end

getPropsCallback = function()
return self.props
end

self.state = {
value = 0
}
Expand All @@ -355,6 +359,9 @@ return function()
expect(getStateCallback().value).to.equal(0)

setStateCallback(function(state, props)
expect(state).to.equal(getStateCallback())
expect(props).to.equal(getPropsCallback())

return {
value = state.value + 1
}
Expand Down

0 comments on commit 632dbcb

Please sign in to comment.