{"enrichment":{"faq":[{"a":"vitest-testing-patterns teaches you to write unit and component tests using Vitest and React Testing Library. Start by importing describe, it, and expect from Vitest, then use React Testing Library's render function to mount components. Write assertions on rendered output using queries like getByRole, getByText, and getByTestId. The skill covers practical patterns for testing user interactions, state changes, and conditional rendering across real-world scenarios.","q":"How to write Vitest tests for React components?"},{"a":"vitest-testing-patterns covers mocking strategies essential for isolating code under test. Use vi.fn() to create mock functions, vi.mock() for module-level mocking, and vi.spyOn() to spy on existing functions. The skill teaches you to mock APIs, databases, and external service dependencies\u2014configure return values with mockReturnValue or mockResolvedValue for async calls. Learn when to use each pattern and how to verify mocks were called correctly with toHaveBeenCalled assertions.","q":"How do I mock functions in Vitest?"},{"a":"vitest-testing-patterns provides comprehensive mocking patterns for external dependencies. Mock API calls by intercepting fetch or axios requests, then return controlled test data. For databases like Drizzle ORM, mock query builders and connection methods. Set up mocks at the module level with vi.mock() or use factory functions for test-specific configurations. The skill teaches you to organize mocks for reusability and maintain clean test isolation across unit, component, and integration tests.","q":"What mocking patterns does Vitest support for APIs and databases?"},{"a":"vitest-testing-patterns covers Vitest environment setup and file organization best practices. Configure vitest.config.ts with test globals, environment settings (jsdom for DOM testing), and coverage thresholds. Organize tests alongside source files using .test.ts or .spec.ts naming conventions, or group them in a dedicated test directory. The skill teaches you to structure mocks, fixtures, and test utilities for maintainability and to set up coverage reporting to track test completeness.","q":"How do I configure Vitest and organize test files?"},{"a":"vitest-testing-patterns teaches testing best practices including proper test coverage strategies, async testing patterns for promises and timers, and accessibility compliance checks. Learn to write descriptive test names, use beforeEach/afterEach hooks for setup, and organize tests with describe blocks. The skill covers timer mocking with vi.useFakeTimers(), testing accessibility with React Testing Library's accessibility queries, and integration test patterns for multi-component workflows.","q":"What testing patterns and best practices does Vitest support?"},{"a":"vitest-testing-patterns includes patterns for testing Next.js API routes with Vitest. Mock the req and res objects, then call your handler function directly or use a test client. Mock external dependencies like databases and third-party APIs that your routes depend on. The skill teaches you to verify response status codes, headers, and body content, plus how to test error handling and edge cases in your API logic.","q":"Can I use Vitest to test Next.js API routes?"}],"shadow_tags":["test-framework","mock-utilities","component-testing","api-testing","test-queries","accessibility-validation","async-testing","test-organization"],"summary_rewrite":"Master test writing with Vitest and React Testing Library through practical patterns for units, components, and integration scenarios. Learn mocking strategies for APIs and external dependencies, plus file organization and coverage setup."},"files":[{"bytes":10223,"path":".claude/skills/vitest-testing-patterns/SKILL.md","sha256":"c149ac25ce8b3a818b56401f9549ee2fb143c1a4d011eae39c1bec706a83ba14","url":"https://skillfed.io/files/curiositech/some_claude_skills/vitest-testing-patterns/3a0623a1/SKILL.md"}],"id":"curiositech/some_claude_skills/vitest-testing-patterns","links":{"html":"https://skillfed.io/curiositech/some_claude_skills/vitest-testing-patterns","md":"https://skillfed.io/curiositech/some_claude_skills/vitest-testing-patterns.md","repo":"https://github.com/curiositech/some_claude_skills"},"meta":{"agents_supported":["claude-code"],"first_seen":"2026-07-28","forks":27,"language":"TypeScript","last_updated":"2026-07-14","license":"MIT","name":"vitest-testing-patterns","publisher":"curiositech","stars":164},"relations":{"similar":[{"id":"Cap-go/capgo-skills/capacitor-testing"},{"id":"prowler-cloud/prowler/vitest"},{"id":"next-safe-action/skills/safe-action-testing"},{"id":"bobmatnyc/claude-mpm-skills/vitest"},{"id":"LambdaTest/agent-skills/vitest-skill"},{"id":"caliber-ai-org/ai-setup/caliber-testing"},{"id":"bobmatnyc/claude-mpm-skills/jest"},{"id":"archestra-ai/archestra/archestra-dev-backend-tests"},{"id":"oakoss/agent-skills/vitest-testing"},{"id":"nodnarbnitram/claude-code-extensions/vitest-v4"}]},"slug":{"owner":"curiositech","repo":"some_claude_skills","skill":"vitest-testing-patterns"},"version":"3a0623a1"}
