Jest Testing Patterns
ChrisWiles/claude-code-showcase
Jest patterns for React Native style tests: TDD discipline, mock factory functions, module and GraphQL hook mocking, custom render helpers and anti-patterns to avoid.
Test @data-client/react with renderDataHook and mountDataClient - jest unit tests, fixtures, interceptors, MockResolver, mock responses, nock HTTP mocking, fake timers for polling/subscription…
$ npx skills add reactive/data-client --skill data-client-react-testing -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install reactive/data-client data-client-react-testing --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/reactive/data-client.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/data-client-react-testing .claude/skills/data-client-react-testing && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "data-client-react-testing" agent skill from https://github.com/reactive/data-client/tree/master/.agents/skills/data-client-react-testing into .claude/skills/data-client-react-testing/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "data-client-react-testing", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/reactive/data-client/tree/master/.agents/skills/data-client-react-testingType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add reactive/data-client --skill data-client-react-testing -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install reactive/data-client data-client-react-testing --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/reactive/data-client.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/data-client-react-testing .agents/skills/data-client-react-testing && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "data-client-react-testing" agent skill from https://github.com/reactive/data-client/tree/master/.agents/skills/data-client-react-testing into .agents/skills/data-client-react-testing/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "data-client-react-testing", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add reactive/data-client --skill data-client-react-testing -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install reactive/data-client data-client-react-testing --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/reactive/data-client.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/data-client-react-testing .cursor/skills/data-client-react-testing && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "data-client-react-testing" agent skill from https://github.com/reactive/data-client/tree/master/.agents/skills/data-client-react-testing into .cursor/skills/data-client-react-testing/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "data-client-react-testing", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/reactive/data-client.git --path .agents/skills/data-client-react-testing--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add reactive/data-client --skill data-client-react-testing -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install reactive/data-client data-client-react-testing --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/reactive/data-client.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/data-client-react-testing .gemini/skills/data-client-react-testing && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "data-client-react-testing" agent skill from https://github.com/reactive/data-client/tree/master/.agents/skills/data-client-react-testing into .gemini/skills/data-client-react-testing/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "data-client-react-testing", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install reactive/data-client data-client-react-testingInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add reactive/data-client --skill data-client-react-testing -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/reactive/data-client.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/data-client-react-testing .github/skills/data-client-react-testing && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "data-client-react-testing" agent skill from https://github.com/reactive/data-client/tree/master/.agents/skills/data-client-react-testing into .github/skills/data-client-react-testing/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "data-client-react-testing", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add reactive/data-client --skill data-client-react-testing -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install reactive/data-client data-client-react-testing --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/reactive/data-client.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/data-client-react-testing .opencode/skills/data-client-react-testing && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "data-client-react-testing" agent skill from https://github.com/reactive/data-client/tree/master/.agents/skills/data-client-react-testing into .opencode/skills/data-client-react-testing/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "data-client-react-testing", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
data-client-react-testingTest @data-client/react with renderDataHook and mountDataClient - jest unit tests, fixtures, interceptors, MockResolver, mock responses, nock HTTP mocking, fake timers for polling/subscription…
Data Client React Testing is an agent skill from reactive/data-client. Test @data-client/react with renderDataHook and mountDataClient - jest unit tests, fixtures, interceptors, MockResolver, mock responses, nock HTTP mocking, fake timers for polling/subscription tests, DataProvider test setup, hook and component testing. Use when writing or debugging tests for hooks, components, or resources built on @data-client/react.
Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 9 other files, including reference files (for example `references.json`, `references/Fixtures.md` and `references/MockResolver.md`).
It sits in Testing & QA, covering Unit testing and Test data and fixtures. It works with React and Jest. The repository describes itself as: Async State Management without the Management. REST, GraphQL, SSE, Websockets. The licence is Apache-2.0.
Read from SKILL.md and the folder at commit 02c0932. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).
From the folder's file list and the shell code blocks in SKILL.md.
Hosts in commands or code, which the agent is likely to contact:
jsonplaceholder.typicode.comFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Data Client React Testing loads about 1.5k tokens when it runs, and up to ~8.5k if it reads all its reference files. Until then it costs about 95 tokens; SKILL.md has 223 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from reactive/data-client at commit 02c0932, republished under its Apache-2.0 licence (© reactive). 223 words, ~1,529 tokens.
.claude/skills/data-client-react-testing/SKILL.md (or your agent's skills folder). This skill also uses 8 other files; get the full folder from GitHub.import { renderDataHook } from '@data-client/test';
it('useSuspense() should render the response', async () => {
const { result, waitFor } = renderDataHook(
() => useSuspense(ArticleResource.get, { id: 5 }),
{
initialFixtures: [
{
endpoint: ArticleResource.get,
args: [{ id: 5 }],
response: { id: 5, title: 'hi ho', content: 'whatever' },
},
],
},
);
expect(result.current.title).toBe('hi ho');
});Options:
initialFixtures - Set up initial state of the storeresolverFixtures - Add interceptors for subsequent requestsgetInitialInterceptorData - Simulate changing server stateReturn values:
renderHook() return values from @testing-library/reactcontroller - Controller instance for manual actionsallSettled() - Wait for all async operations to completeCleanup is automatic -- an afterEach hook is registered at module load time that drains all active cleanups. No manual renderDataHook.cleanup() calls are needed.
Success Fixture:
interface SuccessFixture {
endpoint;
args;
response;
error?;
delay?;
}Response Interceptor:
interface ResponseInterceptor {
endpoint;
response(...args);
delay?;
delayCollapse?;
}Create operations:
it('should create a new todo', async () => {
const { result } = renderDataHook(
() => useController(),
{
initialFixtures: [
{
endpoint: TodoResource.getList,
args: [],
response: [],
},
],
resolverFixtures: [
{
endpoint: TodoResource.getList.push,
response: (newTodo) => ({ ...newTodo, id: 1 }),
},
],
},
);
const newTodo = { title: 'Test Todo', completed: false };
const createdTodo = await result.current.fetch(TodoResource.getList.push, newTodo);
expect(createdTodo.id).toBe(1);
});it('should handle fetch errors', async () => {
const { result, waitFor } = renderDataHook(
() => useSuspense(TodoResource.get, { id: 1 }),
{
initialFixtures: [
{
endpoint: TodoResource.get,
args: [{ id: 1 }],
response: null,
error: new Error('Not found'),
},
],
},
);
await waitFor(() => {
expect(result.current).toBeUndefined();
});
});Use MockResolver to provide fixture data when rendering components with DataProvider:
import { render } from '@testing-library/react';
import { DataProvider } from '@data-client/react';
import { MockResolver } from '@data-client/test';
it('should render todo list', async () => {
const fixtures = [
{
endpoint: TodoResource.getList,
args: [],
response: [{ id: 1, title: 'Test Todo', completed: false }],
},
];
const { getByText } = render(
<DataProvider>
<MockResolver fixtures={fixtures}>
<TodoList />
</MockResolver>
</DataProvider>,
);
expect(getByText('Test Todo')).toBeInTheDocument();
});import nock from 'nock';
it('should fetch data from API', async () => {
const scope = nock('https://jsonplaceholder.typicode.com')
.get('/todos/1')
.reply(200, { id: 1, title: 'Test', completed: false });
const result = await TodoResource.get({ id: 1 });
expect(result.title).toBe('Test');
scope.done();
});it('should handle manager middleware', async () => {
const mockManager = {
middleware: (controller) => (next) => async (action) => {
if (action.type === 'FETCH') {
console.log('Fetch action:', action);
}
return next(action);
},
cleanup: jest.fn(),
};
const { controller } = renderDataHook(
() => useController(),
{ managers: [mockManager] },
);
await controller.fetch(TodoResource.get, { id: 1 });
expect(mockManager.cleanup).not.toHaveBeenCalled();
});Keep tests under packages/*/src/**/__tests__:
packages/react/src/hooks/__tests__/useSuspense.test.ts
packages/react/src/components/__tests__/DataProvider.test.tsxTest naming:
*.node.test.ts[x]*.native.test.ts[x]*.test.ts[x]renderDataHook() for testing hooks that use @data-client/react hooksnock when testing networking definitionsrenderDataHook.cleanup() in afterEach -- cleanup is automaticFor detailed API documentation, see the references directory:
© reactive, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 8 other files (references) in .agents/skills/data-client-react-testing of reactive/data-client.
Open the folder on GitHubat commit 02c0932
Data Client React Testing next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Data Client React Testing this skillreactive/data-client | 2k | — | ~1.5k | Automated safety check: Pass | Apache-2.0 | |
| Jest Testing PatternsChrisWiles/claude-code-showcase | 6.1k | 7 repos | ~1.5k | Automated safety check: Pass | None | |
| Unit TestsKhan/wonder-blocks | 163 | — | ~4.2k | Automated safety check: Pass | MIT | |
| React Testinggetsentry/sentry | 45k | — | ~2.2k | Automated safety check: Pass | Custom licence | |
| Menu Testing Ssrasmyshlyaev177/react-horizontal-scrolling-menu | 790 | — | ~3.5k | Automated safety check: Pass | MIT | |
| Testingredis/RedisInsight | 8.9k | — | ~3.3k | Automated safety check: Pass | Custom licence |
ChrisWiles/claude-code-showcase
Jest patterns for React Native style tests: TDD discipline, mock factory functions, module and GraphQL hook mocking, custom render helpers and anti-patterns to avoid.
Khan/wonder-blocks
Jest + React Testing Library best practices for Wonder Blocks unit tests.
getsentry/sentry
Write and review React/TypeScript tests for Sentry's frontend using Jest and React Testing Library.
asmyshlyaev177/react-horizontal-scrolling-menu
Server rendering and testing for react-horizontal-scrolling-menu: the library is client-only ('use client' required in React Server Components, else "createContext is not a function"), SSR first…
redis/RedisInsight
Unit/integration testing standards for RedisInsight using Jest and Testing Library: test structure, the renderComponent helper, faker for test data, mocking patterns, and waitFor instead of fixed…
rohitg00/skillkit
Applies proven testing patterns — Arrange-Act-Assert (AAA), Given-When-Then, Test Data Builders, Object Mother, parameterized tests, fixtures, spies, and test doubles — to help write maintainable…
reactive/data-client
Set up and migrate to @data-client/rest for REST APIs. An agent skill from reactive/data-client.
reactive/data-client
Implement @data-client Managers for global/background side effects - websocket, SSE, polling, real-time updates, subscriptions, logging, analytics, metrics/timing, error reporting (Sentry), toast…
reactive/data-client
Use @data-client/react hooks for data fetching, mutations, and rendering - useSuspense, useFetch, useQuery, useCache, useLive, useDLE, useSubscription, useController, DataProvider, AsyncBoundary…
reactive/data-client
Define REST APIs with @data-client/rest - resource(), RestEndpoint, CRUD (GET/POST/PUT/PATCH/DELETE), HTTP fetch, normalize, cache, urlPrefix, path-to-regexp parameters, searchParams, pagination…
reactive/data-client
Model data with @data-client schemas (Entity, EntityMixin, Collection, Union, Query, Values, All, Invalidate, Lazy, Scalar) for atomic, consistent, referentially-equal async data via normalization…
reactive/data-client
Use @data-client/vue composables for data fetching, mutations, and rendering - useSuspense, useFetch, useQuery, useCache, useLive, useDLE, useSubscription, useController, useLoading, useDebounce…
Categories
Test @data-client/react with renderDataHook and mountDataClient - jest unit tests, fixtures, interceptors, MockResolver, mock responses, nock HTTP mocking, fake timers for polling/subscription…. Data Client React Testing is an agent skill from reactive/data-client. Test @data-client/react with renderDataHook and mountDataClient - jest unit tests, fixtures, interceptors, MockResolver, mock responses, nock HTTP mocking, fake timers for polling/subscription tests, DataProvider test setup, hook and component testing.
Data Client React Testing fits situations like: debugging tests for hooks; resources built on @data-client/react.
Run `npx skills add reactive/data-client --skill data-client-react-testing -a claude-code`. Or copy the skill folder (.agents/skills/data-client-react-testing in reactive/data-client) into .claude/skills/data-client-react-testing in your project. Claude Code loads it when a task matches its description.
Run `npx skills add reactive/data-client --skill data-client-react-testing -a codex`. Or copy the skill folder (.agents/skills/data-client-react-testing in reactive/data-client) into .agents/skills/data-client-react-testing in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add reactive/data-client --skill data-client-react-testing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/data-client-react-testing, .gemini/skills/data-client-react-testing, .github/skills/data-client-react-testing and .opencode/skills/data-client-react-testing in your project.
SKILL.md names no scripts, command-line tools or credentials: Data Client React Testing is instructions for the agent only.
SKILL.md names 1 domain. In commands or code: jsonplaceholder.typicode.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Data Client React Testing is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.5k tokens (SKILL.md is roughly 6.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 7k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Data Client React Testing: Jest Testing Patterns (ChrisWiles/claude-code-showcase, 6.1k stars), Unit Tests (Khan/wonder-blocks, 163 stars), React Testing (getsentry/sentry, 45k stars) and Menu Testing Ssr (asmyshlyaev177/react-horizontal-scrolling-menu, 790 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
reactive (a GitHub organization) maintains it in reactive/data-client, which has 2,037 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on October 7, 2026.
Source: reactive/data-client on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.