Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/adonai-labs/agent-runway/testing-reactgit clone --depth 1 https://github.com/adonai-labs/agent-runwayWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/adonai-labs/agent-runway/testing-react)<a href="https://agentmods.dev/rules/adonai-labs/agent-runway/testing-react"><img src="https://agentmods.dev/badge/rules/adonai-labs/agent-runway/testing-react.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.02462 |
| Opus 5 | $0.00000 | $0.01231 |
| Sonnet 5 | $0.00000 | $0.00492 |
| Haiku 4.5 | $0.00000 | $0.00246 |
Grade A, and why
testing-react scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 407 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Testing React Applications
Extends core/rules/testing.mdc with React-specific testing patterns using React Testing Library.
Component Testing Principles
- Test behavior, not implementation: Focus on what the user sees and does
- Avoid testing internal state: Test outputs (rendered DOM, calls to callbacks)
- Use accessible queries: Prefer
getByRole,getByLabelTextovergetByTestId - Write tests that resemble how users interact: Click buttons, type in inputs, see text
React Testing Library Queries
Query Priority (from most to least preferred)
import { render, screen } from '@testing-library/react';
// 1. Accessible by everyone (best)
screen.getByRole('button', { name: /submit/i });
screen.getByLabelText('Email address');
screen.getByPlaceholderText('Enter email');
screen.getByText('Welcome');
// 2. Semantic queries
screen.getByAltText('Profile picture');
screen.getByTitle('Close dialog');
// 3. Test IDs (last resort)
screen.getByTestId('custom-element');
Query Variants
// getBy* - throws error if not found
const button = screen.getByRole('button');
// queryBy* - returns null if not found
const button = screen.queryByRole('button');
expect(button).not.toBeInTheDocument();
// findBy* - async, waits for element
const button = await screen.findByRole('button');
// getAllBy*, queryAllBy*, findAllBy* - for multiple elements
const items = screen.getAllByRole('listitem');
Testing Components
Basic Component Test
import { render, screen } from '@testing-library/react';
import { UserProfile } from './UserProfile';
describe('UserProfile', () => {
it('should display user name and email', () => {
render(<UserProfile name="John Doe" email="[email protected]" />);
expect(screen.getByText('John Doe')).toBeInTheDocument();
expect(screen.getByText('[email protected]')).toBeInTheDocument();
});
});
Testing User Interactions
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { LoginForm } from './LoginForm';
describe('LoginForm', () => {
it('should call onSubmit with email and password', async () => {
const user = userEvent.setup();
const handleSubmit = jest.fn();
render(<LoginForm onSubmit={handleSubmit} />);
await user.type(screen.getByLabelText('Email'), '[email protected]');
await user.type(screen.getByLabelText('Password'), 'password123');
await user.click(screen.getByRole('button', { name: /sign in/i }));
expect(handleSubmit).toHaveBeenCalledWith({
email: '[email protected]',
password: 'password123',
});
});
});
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 407 lines · 0 tokens per session scan A 3334eb127581
testing-react is a cursor rule published in the GitHub repository adonai-labs/agent-runway (2 stars, last pushed 15d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,462 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other cursor rules, from other repositories
front-react
Front-app Vitest - Node pool only, isolated QueryClient, no Workers pool.
react-component-hook-testing-auto
Enforces best practices for unit testing React components and custom hooks using React Testing Library and Vitest.
cursorrules
You are working with a React Native (Expo) architecture reference project. Read the skill files before generating any code.
upgrade-tests
// ✅ CORRECT: Upgrade package pattern await using ctx = testReactResource(appRouter, { server: { // server configuration }, client(opts) { return { links: [ httpLink({ url: opts.httpUrl, // client configuration }), ], }; }, }).
react-query-tests
// ✅ CORRECT: Legacy React Query pattern const ctx = konn() .beforeEach(() => createAppRouter()) .afterEach((ctx) => ctx?.close?.()) .done().
tanstack-react-query-tests
// ✅ CORRECT: Use await using for automatic cleanup await using ctx = testReactResource(appRouter, { server: { // server configuration }, client(opts) { return { links: [ httpLink({ url: opts.httpUrl, // client configuration }), ], }; }, }).