redux-saga-testing
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".
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/anivar/redux-saga-testingWhat This Skill Does
The redux-saga-testing skill provides a comprehensive framework for testing complex side-effect logic in Redux Sagas. By leveraging the power of redux-saga-test-plan, this skill enables developers to write robust, maintainable tests that verify asynchronous flows without becoming overly coupled to the internal execution sequence of generator functions. It supports modern testing frameworks including Jest and Vitest, and provides a clear API for integration, unit, and manual testing of saga effects.
Installation
To integrate this skill into your environment, run the following command in your terminal:
clawhub install openclaw/skills/skills/anivar/redux-saga-testing
Ensure your project has the necessary dev dependencies, specifically redux-saga, redux-saga-test-plan, and your preferred test runner (Jest or Vitest) installed before attempting to run your first test suite.
Use Cases
This skill is specifically designed for complex Redux state management environments where Sagas handle API orchestration, polling, or cross-service communication. You should use this skill when you need to:
- Mock external API calls using static or dynamic providers.
- Validate that specific actions are dispatched after successful or failed asynchronous tasks.
- Test race conditions and cancellation patterns in long-running processes.
- Perform unit tests on generators where execution order is strictly mandated.
- Simulate error conditions and edge cases that are difficult to trigger in a live development environment.
Example Prompts
- "Create a test suite for the
userProfileSagathat usesexpectSagato verify the fetch success flow and mock thefetchUserDataAPI call." - "Help me refactor this saga test to use a dynamic provider, as I need to handle different responses based on the input arguments passed to the service function."
- "My saga is failing the test because of a timeout. Can you suggest how to use
silentRun()or increase the timeout setting inexpectSagato fix this?"
Tips & Limitations
Always treat the project's source code as the ultimate source of truth, as redux-saga-test-plan APIs can vary between versions. Prioritize expectSaga (integration) over testSaga (unit) to prevent brittle tests that break during minor refactors. When working with dynamic providers, ensure that you properly call the next() function to avoid blocking the middleware chain, which could lead to hanging tests. Avoid manual .next() calls whenever possible, as they are the most error-prone and hardest to maintain as your saga logic grows in complexity.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-anivar-redux-saga-testing": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: code-execution
Related Skills
zod-testing
Testing patterns for Zod schemas using Jest and Vitest. Covers schema correctness testing, mock data generation, error assertion patterns, integration testing with API handlers and forms, snapshot testing with z.toJSONSchema(), and property-based testing. Baseline: zod ^4.0.0. Triggers on: test files for Zod schemas, zod-schema-faker imports, mentions of "test schema", "schema test", "zod mock", "zod test", or schema testing patterns.
jest
Jest best practices, patterns, and API guidance for JavaScript/TypeScript testing. Covers mock design, async testing, matchers, timer mocks, snapshots, module mocking, configuration, and CI optimization. Baseline: jest ^29.0.0 / ^30.0.0. Triggers on: jest imports, describe, it, test, expect, jest.fn, jest.mock, jest.spyOn, mentions of "jest", "unit test", "test suite", or "mock".
zod
Zod v4 best practices, patterns, and API guidance for schema validation, parsing, error handling, and type inference in TypeScript applications. Covers safeParse, object composition, refinements, transforms, codecs, branded types, and v3→v4 migration. Baseline: zod ^4.0.0. Triggers on: zod imports, z.object, z.string, z.infer, safeParse, mentions of "zod", "schema validation", "zod v4", or "z.enum".
redux-saga
Redux-Saga best practices, patterns, and API guidance for building, testing, and debugging generator-based side-effect middleware in Redux applications. Covers effect creators, fork model, channels, testing with redux-saga-test-plan, concurrency, cancellation, and modern Redux Toolkit integration. Baseline: redux-saga 1.4.2. Triggers on: saga files, redux-saga imports, generator-based middleware, mentions of "saga", "takeEvery", "takeLatest", "fork model", or "channels".
msw
MSW (Mock Service Worker) v2 best practices, patterns, and API guidance for API mocking in JavaScript/TypeScript tests and development. Covers handler design, server setup, response construction, testing patterns, GraphQL, and v1-to-v2 migration. Baseline: msw ^2.0.0. Triggers on: msw imports, http.get, http.post, HttpResponse, setupServer, setupWorker, graphql.query, mentions of "msw", "mock service worker", "api mocking", or "msw v2".