1. How do you test createAsyncThunk functions and what should you test?
Test async thunks by mocking the API calls or dependencies, calling the thunk with test arguments and a mock dispatch function, and asserting that it dispatches the correct pending, fulfilled, or rejected actions with expected payloads. You should test the happy path where the async operation succeeds, error cases where it fails, that the payload creator receives correct arguments, that dispatch is called with appropriate actions in order, and any conditional logic or error transformation in the thunk. Use testing libraries like jest to mock fetch or axios, or test utilities like Redux Mock Store to track dispatched actions, and consider testing the reducer's handling of these actions separately for complete coverage.