testing

Write unit, API, and component tests using Vitest and Testing Library.

Updated Dec 15, 2025
One-click install
npx skills add https://github.com/jhlee0409/sidedish --skill testing-jhlee0409
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/jhlee0409/sidedish/tree/main/.claude/skills/testing
Command: npx skills add https://github.com/jhlee0409/sidedish --skill testing-jhlee0409

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Vitest와 Testing Library를 활용한 단위/통합 테스트 작성 및 mocks 패턴을 표준화합니다.

Core Features & Use Cases

  • Test templates & patterns: 기본 구조와 검사 방법
  • Firebase Mocking: firebase-external 서비스 모킹 방법
  • 커버리지 목표: 80% 이상 달성 가이드

Quick Start

src/tests/에 새로운 테스트 파일을 추가하고 Firebase를 모킹합니다.

Frequently Asked Questions about testing

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

FAQPage Schema
How do I write unit tests with Vitest and Testing Library?

Vitest and Testing Library provide a describe/it/expect pattern for writing unit tests. Create test files in src/__tests__/ using templates that cover functional requirements, apply assertions across frontend and backend modules, and configure coverage targets of 80% statements, 70% branches, and 80% functions.

How do I mock Firebase in my tests?

Mock Firebase external services by setting up fake implementations in your test files before importing modules that depend on Firebase. This prevents actual API calls during testing and allows you to control mock behavior and verify interactions with Firebase methods.

Can I use Vitest for both frontend and backend testing?

Yes, Vitest supports unit, API, and component tests across frontend and backend code. You can apply the same describe/it/expect pattern and mocking strategies to test logic in different parts of your application using Testing Library assertions.

What coverage targets should my tests meet?

Aim for at least 80% statement coverage, 70% branch coverage, and 80% function coverage. These targets ensure your tests validate both the happy path and edge cases across your codebase, with slightly relaxed branch coverage accounting for complex conditional logic.

How do I mock external services beyond Firebase?

Apply the same mocking pattern used for Firebase to other external services: define mock implementations, replace real service calls with mocks in your test setup, and verify that your code interacts with mocks as expected using Testing Library assertions and Vitest spy functions.