9

I am using Redux Toolkit approach by creating:

  1. slices with reducer and extra reducers
  2. thunks with createAsyncThunk API

I Want to understand what is the best way to test with React Testing Library the:

  1. slices with reducer and extra reducers
  2. thunks with createAsyncThunk API

A sample is given in the below gist: https://gist.github.com/subhranshudas/8021ec6d205a05680bc9e11f3ef7fb7d

Any feedback is appreciated.

Note: I had asked the same question in Reddit and got the following reply: https://www.reddit.com/r/reduxjs/comments/hvwqc9/reduxtoolkit_unit_testing_strategy/ While I am clear with the "what" from the response, I am looking for a definitive "how" with React Testing Library.

Apologies if it is an obvious question, but I am interested in checking out the definitive ways to do so in React Testing Library (since I am new to it)

Thanks!

Bruno Peres
  • 15,178
  • 5
  • 43
  • 71
Subhranshu
  • 313
  • 1
  • 10

0 Answers0