jest-testing

Generates Jest and React Testing Library unit tests for React components with mocks and structure.

Updated Feb 10, 2026
One-click install
npx skills add https://github.com/lorenamellado/demo-portal-agents-skills --skill jest-testing-lorenamellado
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jest-testing
Source: https://github.com/lorenamellado/demo-portal-agents-skills/tree/main/.agents/skills/jest-testing
Command: npx skills add https://github.com/lorenamellado/demo-portal-agents-skills --skill jest-testing-lorenamellado

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Este skill facilita la creación y mantenimiento de tests de componentes React, asegurando que el equipo cubra aspectos clave como renderizado, validación, interacción y accesibilidad, sin mezclar pruebas de servicios o hooks.

Core Features & Use Cases

  • Genera pruebas unitarias para componentes React utilizando Jest y React Testing Library.
  • Establece patrones de mocks (p. ej., useAuth) y una estructura de describe/it clara para casos de validación, éxito y manejo de errores.
  • Proporciona guías de selección de elementos para pruebas accesibles (roles, labels, etc.) y buenas prácticas de escritura de tests.

Quick Start

Escribe un test básico para un componente React utilizando Jest y React Testing Library siguiendo la estructura de ejemplo.

Frequently Asked Questions about jest-testing

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

FAQPage Schema
How do I write React component tests with Jest and React Testing Library?

Writing React component tests with Jest and RTL involves structuring describe/it blocks, mocking dependencies like useAuth, and using accessible selectors to validate rendering, interactions, and error handling.

How do I mock useAuth and other hooks in Jest component tests?

Mocking hooks like useAuth in Jest tests requires establishing defined mock patterns within the test suite structure to isolate component behavior and validate success and error handling scenarios.

What is the best way to select elements in React Testing Library for accessibility coverage?

Selecting elements in React Testing Library for accessibility coverage requires using queries based on roles and labels, ensuring tests interact with the UI exactly as users would.

Can I use Jest and RTL to test React hooks and service logic?

Jest and RTL are structured here exclusively for frontend component and UI testing, explicitly excluding service or hook tests to maintain strict separation between UI validation and logic testing.

Does this Jest testing approach work with TypeScript React components?

TypeScript React components are fully supported, allowing the test suite to maintain type safety while validating rendering, interactions, and error handling using Jest and React Testing Library.