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/vue composables and components - renderDataCompose, mountDataClient, fixtures, jest, nock HTTP mocking, polling/subscription tests with fake timers, useSuspense, useLive…
$ npx skills add reactive/data-client --skill data-client-vue-testing -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install reactive/data-client data-client-vue-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-vue-testing .claude/skills/data-client-vue-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-vue-testing" agent skill from https://github.com/reactive/data-client/tree/master/.agents/skills/data-client-vue-testing into .claude/skills/data-client-vue-testing/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "data-client-vue-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-vue-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-vue-testing -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install reactive/data-client data-client-vue-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-vue-testing .agents/skills/data-client-vue-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-vue-testing" agent skill from https://github.com/reactive/data-client/tree/master/.agents/skills/data-client-vue-testing into .agents/skills/data-client-vue-testing/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "data-client-vue-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-vue-testing -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install reactive/data-client data-client-vue-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-vue-testing .cursor/skills/data-client-vue-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-vue-testing" agent skill from https://github.com/reactive/data-client/tree/master/.agents/skills/data-client-vue-testing into .cursor/skills/data-client-vue-testing/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "data-client-vue-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-vue-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-vue-testing -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install reactive/data-client data-client-vue-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-vue-testing .gemini/skills/data-client-vue-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-vue-testing" agent skill from https://github.com/reactive/data-client/tree/master/.agents/skills/data-client-vue-testing into .gemini/skills/data-client-vue-testing/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "data-client-vue-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-vue-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-vue-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-vue-testing .github/skills/data-client-vue-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-vue-testing" agent skill from https://github.com/reactive/data-client/tree/master/.agents/skills/data-client-vue-testing into .github/skills/data-client-vue-testing/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "data-client-vue-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-vue-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-vue-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-vue-testing .opencode/skills/data-client-vue-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-vue-testing" agent skill from https://github.com/reactive/data-client/tree/master/.agents/skills/data-client-vue-testing into .opencode/skills/data-client-vue-testing/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "data-client-vue-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-vue-testingTest @data-client/vue composables and components - renderDataCompose, mountDataClient, fixtures, jest, nock HTTP mocking, polling/subscription tests with fake timers, useSuspense, useLive…
Data Client Vue Testing is an agent skill from reactive/data-client. Test @data-client/vue composables and components - renderDataCompose, mountDataClient, fixtures, jest, nock HTTP mocking, polling/subscription tests with fake timers, useSuspense, useLive, useSubscription, Vue 3 reactive props. Use when writing or debugging tests for composables or components built on @data-client/vue.
Its SKILL.md is about 2.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including reference files (for example `references.json`, `references/Fixtures.md` and `references/mockInitialState.md`).
It sits in Testing & QA, covering Unit testing and Test data and fixtures. It works with Vue.js and Jest. The repository describes itself as: Async State Management without the Management. REST, GraphQL, SSE, Websockets. The licence is Apache-2.0.
4 steps, taken from the first numbered list in SKILL.md.
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.
No URLs in SKILL.md.
From 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 Vue Testing loads about 2.7k tokens when it runs, and up to ~11k if it reads all its reference files. Until then it costs about 86 tokens; SKILL.md has 515 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). 515 words, ~2,724 tokens.
.claude/skills/data-client-vue-testing/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.import { renderDataCompose } from '@data-client/vue/test';
import { reactive, computed } from 'vue';
it('useQuery() should return cached data', async () => {
const { result } = await renderDataCompose(
() => useQuery(Article, { id: 5 }),
{
initialFixtures: [
{
endpoint: ArticleResource.get,
args: [{ id: 5 }],
response: { id: 5, title: 'hi ho', content: 'whatever' },
},
],
},
);
expect(result.value).toEqual(Article.fromJS({ id: 5, title: 'hi ho', content: 'whatever' }));
});Options:
initialFixtures - Pre-populate store state (static fixtures)resolverFixtures - Intercept requests with dynamic responsesprops - Reactive props object (use reactive())managers, initialState, gcPolicy - Custom configurationReturn values (renderDataCompose() is async; always await it):
result - Whatever the composable returned: useQuery/useCache give a ComputedRef (.value is undefined when not in the store); useSuspense gives a Promise of one, so await result once, then read .value, which stays reactivecontroller - Controller instance for manual actionswrapper - Vue Test Utils wrappercleanup() - Cleanup function (always call in afterEach/after test)allSettled() - Wait for all in-flight fetches (including ones a prop change just started) and the re-renderwaitForNextUpdate() - Deprecated: it gives up silently after 1 second, so a test can pass while still suspended, and can hang under fake timers. Use await result for a Promise result, and await allSettled() after changing props or calling the controllerimport { mountDataClient } from '@data-client/vue/test';
import { defineComponent, h, reactive } from 'vue';
it('should render article component', async () => {
const ArticleComp = defineComponent({
props: { id: Number },
async setup(props) {
const article = await useSuspense(ArticleResource.get, () => ({ id: props.id }));
return () => h('div', [
h('h3', article.value.title),
h('p', article.value.content),
]);
},
});
const props = reactive({ id: 5 });
const { wrapper, cleanup } = mountDataClient(ArticleComp, {
props,
initialFixtures: [
{
endpoint: ArticleResource.get,
args: [{ id: 5 }],
response: { id: 5, title: 'hi ho', content: 'whatever' },
},
],
});
await flushUntil(() => wrapper.find('h3').exists());
expect(wrapper.find('h3').text()).toBe('hi ho');
cleanup();
});Features:
data-testid="suspense-fallback" to test loading statewrapper, controller, app, cleanup() and allSettled()flushUntil(predicate) (for component tests): copy the helper from waiting for renders; it throws if the condition never holds.
await flushUntil(() => wrapper.find('h3').exists());
await flushUntil(() => wrapper.find('h3').text() === 'Expected Title');Pattern 1: Testing prop changes:
const props = reactive({ id: 1 });
const { result } = await renderDataCompose(
() => useQuery(Article, computed(() => ({ id: props.id }))),
{
initialFixtures: [
{ endpoint: ArticleResource.get, args: [{ id: 1 }], response: { id: 1, title: 'First' } },
{ endpoint: ArticleResource.get, args: [{ id: 2 }], response: { id: 2, title: 'Second' } },
],
},
);
expect(result.value?.title).toBe('First');
// Change props - result updates after a tick
props.id = 2;
await nextTick();
expect(result.value?.title).toBe('Second');Pattern 2: Conditional arguments (null handling):
const props = reactive({ id: 1 as number | null });
const { result } = await renderDataCompose(
(props: { id: number | null }) =>
useSuspense(ArticleResource.get, computed(() => props.id !== null ? { id: props.id } : null)),
{ props },
);
const articleRef = await result;
expect(articleRef.value).toBeDefined();
// Set to null - becomes undefined
props.id = null;
await nextTick();
expect(articleRef.value).toBeUndefined();Static Fixture:
{
endpoint: ArticleResource.get,
args: [{ id: 5 }],
response: { id: 5, title: 'hi ho', content: 'whatever' },
}Dynamic Interceptor:
resolverFixtures: [
{
endpoint: ArticleResource.get,
response: ({ id }) => ({ id, title: `Article ${id}`, content: 'dynamic' }),
},
]Error Fixture:
{
endpoint: ArticleResource.get,
args: [{ id: 5 }],
response: new Error('Not found'),
error: true,
}it('should update collection when pushed', async () => {
const { result, controller } = await renderDataCompose(
() => useQuery(ArticleResource.getList.schema, {}),
{
initialFixtures: [
{ endpoint: ArticleResource.getList, args: [], response: [{ id: 1, title: 'First' }] },
],
resolverFixtures: [
{ endpoint: ArticleResource.getList.push, response: (body) => body },
],
},
);
expect(result.value?.length).toBe(1);
await controller.fetch(ArticleResource.getList.push, {
id: 2,
title: 'Second',
content: 'new',
});
await nextTick();
expect(result.value?.length).toBe(2);
});setResponse() for instant updates:
const { result, controller } = await renderDataCompose(() => useSuspense(...));
const dataRef = await result;
expect(dataRef.value.title).toBe('Original');
controller.setResponse(
ArticleResource.get,
{ id: 5 },
{ id: 5, title: 'Updated', content: 'new content' }
);
await nextTick();
expect(dataRef.value.title).toBe('Updated'); // Reactive!Use nock when a test must exercise the real fetch path — verifying URL construction, headers, request bodies, retries, or anything in your RestEndpoint/Resource networking layer. For pure store/state behavior, prefer initialFixtures/resolverFixtures (lighter and faster).
Minimal shape:
import nock from 'nock';
beforeAll(() => {
nock(/.*/)
.persist()
.defaultReplyHeaders({ 'Access-Control-Allow-Origin': '*', 'Content-Type': 'application/json' })
.options(/.*/).reply(200) // CORS preflight (required in JSDOM)
.get('/article/5').reply(200, { id: 5, title: 'hi ho' });
});
afterAll(() => nock.cleanAll());For dynamic server state, mutating-closure replies, request spying with jest.fn(), error responses, and mixing nock with fixtures, see references/nock-http-mocking.md.
For composables with pollFrequency, useLive, or useSubscription, use fake timers so polls fire deterministically. Core flow:
jest.useFakeTimers() before mount/render (so the interval is created under fake timers).jest.advanceTimersByTime(frequency) to drive the initial fetch.responseMock.mockReturnValue(...)), advance time again, await allSettled() and await nextTick().afterEach: jest.useRealTimers().Quick example:
jest.useFakeTimers();
const responseMock = jest.fn(() => payload);
const { result, allSettled, cleanup } = await renderDataCompose(
() => useSuspense(PollingArticleResource.get, { id: payload.id }),
{ resolverFixtures: [{ endpoint: PollingArticleResource.get, response: responseMock }] },
);
jest.advanceTimersByTime(frequency);
await allSettled();
const articleRef = await result;
responseMock.mockReturnValue({ ...payload, title: 'updated' });
jest.advanceTimersByTime(frequency);
await allSettled();
await nextTick();
expect(articleRef!.value.title).toBe('updated');
jest.useRealTimers();
cleanup();For unsubscribe patterns, component-level polling tests, fake-timer-safe flushUntil, polling via nock, and common pitfalls, see references/polling-subscriptions.md.
useSuspense(Resource.get, () => ({ id: props.id })) follows prop changes; a plain { id: props.id } is read onceFor detailed API documentation, see the references directory:
DataClientPluginmountDataClient() guide, setup and optionsrenderDataCompose() guideuseLive/useSubscription/pollFrequency, unsubscribe verification, polling via nockEmpty state test:
const { result } = await renderDataCompose(() => useQuery(Article, { id: 5 }));
expect(result.value).toBe(undefined);Testing nested collections:
const userTodos = new Collection(new schema.Array(Todo), {
argsKey: ({ userId }) => ({ userId }),
});
const { result } = await renderDataCompose(
() => useQuery(userTodos, { userId: '1' }),
{ initialFixtures: [/* ... */] },
);
expect(result.value?.length).toBe(2);
expect(result.value?.[0]).toBeInstanceOf(Todo);© 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 7 other files (references) in .agents/skills/data-client-vue-testing of reactive/data-client.
Open the folder on GitHubat commit 02c0932
Data Client Vue 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 Vue Testing this skillreactive/data-client | 2k | — | ~2.7k | Automated safety check: Pass | Apache-2.0 | |
| Jest Testing PatternsChrisWiles/claude-code-showcase | 6.1k | 7 repos | ~1.5k | Automated safety check: Pass | None | |
| Write Jest Testsrundeck/rundeck | 6.3k | — | ~486 | Automated safety check: Notes | Apache-2.0 | |
| Testingredis/RedisInsight | 8.9k | — | ~3.3k | Automated safety check: Pass | Custom licence | |
| Test Patternsrohitg00/skillkit | 1.5k | — | ~1.8k | Automated safety check: Pass | Apache-2.0 | |
| Testing Patternsbybren-llc/safe-agentic-workflow | 421 | — | ~1.5k | Automated safety check: Notes | MIT |
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.
rundeck/rundeck
Write Vue component unit tests. An agent skill from rundeck/rundeck.
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…
bybren-llc/safe-agentic-workflow
Testing patterns for Jest and Playwright. An agent skill from bybren-llc/safe-agentic-workflow.
bybren-llc/safe-agentic-workflow
Testing patterns for Jest and Playwright. An agent skill from bybren-llc/safe-agentic-workflow.
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
Test @data-client/react with renderDataHook and mountDataClient - jest unit tests, fixtures, interceptors, MockResolver, mock responses, nock HTTP mocking, fake timers for polling/subscription…
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…
Categories
Test @data-client/vue composables and components - renderDataCompose, mountDataClient, fixtures, jest, nock HTTP mocking, polling/subscription tests with fake timers, useSuspense, useLive…. Data Client Vue Testing is an agent skill from reactive/data-client. Test @data-client/vue composables and components - renderDataCompose, mountDataClient, fixtures, jest, nock HTTP mocking, polling/subscription tests with fake timers, useSuspense, useLive, useSubscription, Vue 3 reactive props.
Data Client Vue Testing fits situations like: debugging tests for composables; components built on @data-client/vue.
Run `npx skills add reactive/data-client --skill data-client-vue-testing -a claude-code`. Or copy the skill folder (.agents/skills/data-client-vue-testing in reactive/data-client) into .claude/skills/data-client-vue-testing in your project. Claude Code loads it when a task matches its description.
Run `npx skills add reactive/data-client --skill data-client-vue-testing -a codex`. Or copy the skill folder (.agents/skills/data-client-vue-testing in reactive/data-client) into .agents/skills/data-client-vue-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-vue-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-vue-testing, .gemini/skills/data-client-vue-testing, .github/skills/data-client-vue-testing and .opencode/skills/data-client-vue-testing in your project.
SKILL.md names no scripts, command-line tools or credentials: Data Client Vue Testing is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. 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 Vue 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 2.7k tokens (SKILL.md is roughly 11k 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 8.5k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Data Client Vue Testing: Jest Testing Patterns (ChrisWiles/claude-code-showcase, 6.1k stars), Write Jest Tests (rundeck/rundeck, 6.3k stars), Testing (redis/RedisInsight, 8.9k stars) and Test Patterns (rohitg00/skillkit, 1.5k 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.