You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to establish a pattern for testing that components produce
expected output based on the inputs they are given. We also want to
have a pattern for testing components that are connected to Redux
state.
The component/store seam is a useful place to validate behavior.
We have state-focused tests that ensure that dispatched actions update
the state in expected ways; this issue is about ensuring that
the components handle a given state in the expected way; and
the components dispatch actions in expected ways in response to interactions
(e.g. the onPress handler of a button)
Plan of action
Create sample tests for these cases:
Presentation-only test
Either:
Test a component that isn't connect()ed to Redux; or
Export a presentation component (the one you wrap with connect())
Pass it props and assert something based on the rendered DOM
Test mapStateToProps/mapDispatchToProps directly
Pass them a state object / dispatch function
Assert on the resulting props object
For mapDispatchToProps, assert that the functions returned dispatch the expected action(s)
The text was updated successfully, but these errors were encountered:
split from #15
Motivation
We want to establish a pattern for testing that components produce
expected output based on the inputs they are given. We also want to
have a pattern for testing components that are connected to Redux
state.
The component/store seam is a useful place to validate behavior.
We have state-focused tests that ensure that dispatched actions update
the state in expected ways; this issue is about ensuring that
(e.g. the
onPress
handler of a button)Plan of action
Create sample tests for these cases:
connect()
ed to Redux; orconnect()
)mapStateToProps
/mapDispatchToProps
directlystate
object /dispatch
functionmapDispatchToProps
, assert that the functions returned dispatch the expected action(s)The text was updated successfully, but these errors were encountered: