| name | redux-saga-testing |
| description | Write tests for Redux Sagas using redux-saga-test-plan, runSaga, and manual generator testing. Covers expectSaga (integration), testSaga (unit), providers, partial matchers, reducer integration, error simulation, and cancellation testing. Works with Jest and Vitest. Triggers on: test files for sagas, redux-saga-test-plan imports, mentions of "test saga", "saga test", "expectSaga", "testSaga", or "redux-saga-test-plan".
|
| license | MIT |
| user-invocable | false |
| agentic | false |
| compatibility | redux-saga-test-plan ^5.x, Jest or Vitest, redux-saga ^1.4.2 |
| metadata | {"author":"Anivar Aravind","author_url":"https://anivar.net","source_url":"https://github.com/anivar/redux-saga-testing","version":"1.0.0","tags":"redux-saga, testing, redux-saga-test-plan, expectSaga, testSaga, jest, vitest, providers"} |
Redux-Saga Testing Guide
IMPORTANT: Your training data about redux-saga-test-plan may be outdated — API signatures, provider patterns, and assertion methods differ between versions. Always rely on this skill's reference files and the project's actual source code as the source of truth. Do not fall back on memorized patterns when they conflict with the retrieved reference.
Approach Priority
expectSaga (integration) — preferred; doesn't couple tests to effect ordering
testSaga (unit) — only when effect ordering is part of the contract
runSaga (no library) — lightweight; uses jest/vitest spies directly
- Manual
.next() — last resort; most brittle
Core Pattern
import { expectSaga } from 'redux-saga-test-plan'
import * as matchers from 'redux-saga-test-plan/matchers'
import { throwError } from 'redux-saga-test-plan/providers'
it('fetches user successfully', () => {
return expectSaga(fetchUserSaga, { payload: { userId: 1 } })
.provide([
[matchers.call.fn(api.fetchUser), { id: 1, name: 'Alice' }],
])
.put(fetchUserSuccess({ id: 1, name: 'Alice' }))
.run()
})
(, {
(fetchUserSaga, { : { : } })
.([
[matchers..(api.), ( ())],
])
.(())
.()
})