Test Automation
Testing RTK Query: Cache Invalidation, Mutations, and Optimistic Updates
RTK Query is Redux Toolkit's built-in data fetching and caching solution. It generates hooks, reducers, and action creators from endpoint definitions — which means testing it requires a different approach than testing hand-written reducers. You need to test the API layer, cache behavior, and the mutations that invalidate it.