react-transmit icon indicating copy to clipboard operation
react-transmit copied to clipboard

Provide some test examples for react-transmit components

Open zerkalica opened this issue 9 years ago • 2 comments

How to write unit-tests for react transmitted components. mocha+chai or jest. is there a some differences for react or react-transmitted components?. Can i test component without calling fetch method?

zerkalica avatar Apr 14 '15 21:04 zerkalica

How are you testing regular React components right now? Transmit containers are simply React components that either render nothing, or render the wrapped component with additional transmitted props. If you could provide an example test where you're stuck then I could explain it more using that test case.

RickWong avatar Apr 14 '15 22:04 RickWong

I create some examples: https://gist.github.com/zerkalica/a1d2842ee0de9132eff7

My questions: For tests:

  1. Without dom emulation: how to provide fakeQueryParams and reproduce state of UserList without rendering into document (componentWillMount not called)
  2. With dom emulation: Mocking fetch in UserList is right way ?

For app:

  1. How to change UserList state without fetching new users. We don't use setState, only setQueryParams ?
  2. How to do onUserDelete action right way in relay paradigm, without flux actions/stores
  3. Is relay/transmit standalone state-manipulation technology (like flux) or only data-fetching layer ?

zerkalica avatar Apr 16 '15 09:04 zerkalica