{"enrichment":{"faq":[{"a":"React Testing Library prioritizes queries by user perspective: getByRole is preferred for accessible elements, followed by getByLabelText, getByPlaceholderText, and getByText. Avoid getByTestId unless elements lack semantic meaning. The testing skill emphasizes accessibility-first query selection to ensure tests reflect how users interact with components, reducing brittle tests tied to implementation details.","q":"What are React Testing Library best practices for query selection?"},{"a":"The testing skill recommends userEvent over fireEvent for simulating realistic user interactions. userEvent dispatches actual browser events and handles user behavior sequences (typing, clicking with modifiers), while fireEvent directly triggers events without user context. Use userEvent for most scenarios; fireEvent only when testing low-level event handling. This approach better validates component behavior.","q":"How should I choose between userEvent vs fireEvent in React testing?"},{"a":"React Testing Library's testing skill teaches async patterns: use findBy queries (which combine getBy + waitFor) for elements appearing after async operations, or explicitly wrap assertions in waitFor for state updates. Avoid testing implementation details like state changes; instead, verify DOM updates users see. This ensures tests remain maintainable and reflect actual user experience.","q":"What's the proper async testing pattern with waitFor and findBy queries?"},{"a":"The testing skill covers Vitest setup with Mock Service Worker for API mocking: configure Vitest's test environment, import MSW handlers, establish server setup in beforeAll/afterEach hooks, and define request mocks matching your API contracts. This approach isolates component tests from network calls, enabling reliable, fast test execution without external dependencies.","q":"How do I set up Vitest with MSW for component testing?"},{"a":"The testing skill identifies key anti-patterns: testing implementation details (internal state, component methods), using getByTestId as default, relying on fireEvent for user simulation, and not awaiting async operations. Instead, test user-visible behavior, prioritize semantic queries, use userEvent, and properly handle async patterns. These practices prevent brittle tests and maintain long-term test suite health.","q":"What common testing anti-patterns should I avoid?"},{"a":"React Testing Library's testing skill emphasizes getByRole queries elements by their accessible role (button, heading, textbox), encouraging semantic HTML and accessibility compliance. getByTestId targets data-testid attributes, tying tests to implementation. Prefer getByRole to ensure components remain accessible and tests validate real user interactions rather than internal structure.","q":"How does getByRole differ from getByTestId in testing?"}],"shadow_tags":["accessibility-first-testing","user-centric-validation","async-test-patterns","query-hierarchy","test-environment-setup","mock-server-integration","component-interaction-testing","anti-pattern-prevention"],"summary_rewrite":"Master React Testing Library fundamentals through accessibility-first query selection, user-centric event simulation, and async handling patterns. Learn when to use getByRole, userEvent, and findBy queries, plus common pitfalls to avoid in component testing."},"files":[{"bytes":6387,"path":"skills/testing/SKILL.md","sha256":"bccd7bd1abc8f4cab46a058c5d9787d88579d3627a1fcf5b9d5cbea571f573e6","url":"https://skillfed.io/files/DaleStudy/skills/testing/4c55af14/SKILL.md"}],"gist":{"api_url":"https://skillfed.io/api/skills/DaleStudy/skills/testing.json","as_of":"2026-04-07","description":"Testing teaches React Testing Library best practices centered on user-focused component testing with proper. npx skillfed install DaleStudy/skills/testing","install":{"file":"skills/testing/SKILL.md","manual":["git clone https://github.com/DaleStudy/skills","cp -r skills/skills/testing ~/.claude/skills/testing"],"primary":"npx skillfed install DaleStudy/skills/testing","version":"4c55af14"},"kind":"skill","mirror_url":"https://skillfed.io/DaleStudy/skills/testing.md","similar":[{"id":"itechmeat/llm-code/react-testing-library","name":"react-testing-library","publisher":"itechmeat/llm-code","url":"https://skillfed.io/itechmeat/llm-code/react-testing-library"},{"id":"hieutrtr/ai1-skills/react-testing-patterns","name":"React Testing Patterns","publisher":"hieutrtr/ai1-skills","url":"https://skillfed.io/hieutrtr/ai1-skills/react-testing-patterns"},{"id":"prowler-cloud/prowler/vitest","name":"vitest","publisher":"prowler-cloud/prowler","url":"https://skillfed.io/prowler-cloud/prowler/vitest"},{"id":"manutej/luxor-claude-marketplace/jest-react-testing","name":"Jest React Testing","publisher":"manutej/luxor-claude-marketplace","url":"https://skillfed.io/manutej/luxor-claude-marketplace/jest-react-testing"},{"id":"affaan-m/ECC/react-testing","name":"react-testing","publisher":"affaan-m/ECC","url":"https://skillfed.io/affaan-m/ECC/react-testing"}],"title":"testing by DaleStudy: Learn React Testing Library best practices and query priorities \u2014 SkillFed","use":{"when":["The testing skill recommends userEvent over fireEvent for simulating realistic user interactions.","React Testing Library's testing skill teaches async patterns: use findBy queries (which combine getBy + waitFor) for elements appearing."]},"verify":{"line":"Read SKILL.md below before installing","n_files":8},"what":{"lead":"Testing teaches React Testing Library best practices centered on user-focused component testing with proper query priorities.","rest":"Master React Testing Library fundamentals through accessibility-first query selection, user-centric event simulation, and async handling patterns. Learn when to use getByRole, userEvent, and findBy queries, plus common pitfalls to avoid in component testing."}},"id":"DaleStudy/skills/testing","links":{"html":"https://skillfed.io/DaleStudy/skills/testing","md":"https://skillfed.io/DaleStudy/skills/testing.md","repo":"https://github.com/DaleStudy/skills"},"meta":{"agents_supported":[],"first_seen":"2026-07-28","forks":0,"language":"TypeScript","last_updated":"2026-04-07","license":"MIT","name":"testing","publisher":"DaleStudy","stars":4},"relations":{"similar":[{"id":"itechmeat/llm-code/react-testing-library"},{"id":"gohypergiant/agent-skills/accelint-react-testing"},{"id":"hieutrtr/ai1-skills/react-testing-patterns"},{"id":"prowler-cloud/prowler/vitest"},{"id":"manutej/luxor-claude-marketplace/jest-react-testing"},{"id":"affaan-m/ECC/react-testing"},{"id":"callstackincubator/agent-skills/react-native-testing"},{"id":"callstack/react-native-testing-library/react-native-testing"},{"id":"jmsktm/claude-settings/testing-qa"},{"id":"nahisaho/MUSUBI/test-engineer"}]},"slug":{"owner":"DaleStudy","repo":"skills","skill":"testing"},"version":"4c55af14"}
