javascript-testing-patterns

Implement JavaScript and TypeScript testing patterns with Jest, Vitest, Supertest, and Testing Library.

1|Updated Aug 13, 2022
One-click install
npx skills add https://github.com/sskim91/dotfiles --skill javascript-testing-patterns-sskim91
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: javascript-testing-patterns
Source: https://github.com/sskim91/dotfiles/tree/main/claude/skills/javascript-testing-patterns
Command: npx skills add https://github.com/sskim91/dotfiles --skill javascript-testing-patterns-sskim91

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jest, vitest, @testing-library/react, @testing-library/jest-dom, supertest, pg, @faker-js/faker, nodemailer, ts-jest, typescript.

What problem does it solves? This Skill equips developers with the knowledge and patterns to implement robust testing strategies in JavaScript/TypeScript, ensuring code quality, reducing bugs, and accelerating development cycles through reliable unit, integration, and E2E tests.

Core Features & Use Cases

  • Unit Testing: Patterns for testing pure functions, classes, and async code using Jest or Vitest.
  • Mocking Strategies: Techniques for isolating tests by mocking modules, dependencies, and spying on functions.
  • Integration & Frontend Testing: Guides for API integration tests with Supertest and React component/hook testing with Testing Library.
  • Use Case: You're developing a new feature in a React application and need to ensure its reliability. Use this Skill to write comprehensive unit tests for your utility functions, integration tests for your API calls, and component tests for your UI, all with proper mocking.

Quick Start

Help me write a unit test for this JavaScript function that adds two numbers, ensuring it handles edge cases like zero.