core/testing

Test Themis reducers, selectors, and sagas with Vitest and redux-saga-test-plan.

6|6|Updated Jun 29, 2026
One-click install
npx skills add https://github.com/intent-hq/cloudlands-fe --skill core-testing-intent-hq
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: core/testing
Source: https://github.com/intent-hq/cloudlands-fe/tree/main/.agents/skills/themis/core/testing
Command: npx skills add https://github.com/intent-hq/cloudlands-fe --skill core-testing-intent-hq

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires vitest, redux-saga-test-plan, typed-redux-saga, redux-saga.

What problem does it solve? Writing reliable tests for Redux reducers, selectors, and redux-saga workflows is error-prone: developers often assert derived state that selectors should own, call readable selectors directly in Vitest, or forget to mock typed-redux-saga effects correctly. This Skill provides an operational checklist and concrete good/bad examples that keep Themis tests correct and reviewable. ## Core Features & Use Cases - Layer-specific test rules: Defines required test styles for reducers (direct calls, no-op reference equality), collections, selectors (pure .select(state) calls), and sagas (expectSaga/testSaga). - Saga test setup guidance: Shows how to mock typed-redux-saga effects with a tuple-aware call guard so [context, method] calls work, and when to use expectSaga versus testSaga. - State-integrity evidence: Enforces canonical ownership of derived values, duplicate-detection search evidence, and handoff documentation for new actions, selectors, and sagas. - Use Case: When adding a new async action and saga to a Themis feature, use this Skill to write reducer tests with no-op identity checks, selector tests through .select(state), and an expectSaga integration test with provided selector effects. ## Quick Start Ask the AI to write Vitest tests for a Themis reducer, selector, or saga following the core/testing conventions, including typed-redux-saga mocks and no-op reference equality checks.

Frequently Asked Questions about core/testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test redux-saga with typed-redux-saga in Vitest?▼

Mock only the typed-redux-saga effects the saga file uses and map them to redux-saga/effects before importing the saga. The call mock must branch on Array.isArray so [context, method] tuple calls work, then use expectSaga or testSaga from redux-saga-test-plan for assertions.

When should I use expectSaga vs testSaga?▼

Use expectSaga for behavior and integration tests where you provide selector and API effects and assert dispatched actions. Reserve testSaga for order-sensitive generator steps, such as verifying root saga fork or takeLatest watcher registration order.

How do I test Redux selectors in Vitest?▼

Call selectors purely via .select(mockState, ...args) and never invoke the readable selector form in tests. Assert derived outputs through selectors rather than testing reducer-stored derived fields like filtered lists or counts.

Why should reducer tests check no-op reference equality?▼

No-op reference checks prove the reducer returns the same state object when an action changes nothing, preserving identity for memoized selectors and preventing unnecessary re-renders. Use expect(reducer(state, action)).toBe(state) for these cases.

What are common mistakes in saga integration tests?▼

Common failures include forgetting to provide selector effects the worker reads before API calls, importing effect descriptors from typed-redux-saga instead of redux-saga/effects in matchers, and using real long timers instead of .silentRun(0) or bounded durations.