testing-patterns

Implement AAA, Object Mother, and Given-When-Then patterns for Vitest+RTL, Jest, and Playwright tests.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/johnnystefan/test-saas-business --skill testing-patterns-johnnystefan
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: testing-patterns
Source: https://github.com/johnnystefan/test-saas-business/tree/main/skills/testing-patterns
Command: npx skills add https://github.com/johnnystefan/test-saas-business --skill testing-patterns-johnnystefan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a single source of truth for applying AAA, Object Mother, and coverage-rich practices so every unit, integration, and acceptance test in the SaaS monorepo stays predictable and aligned with domain expectations.

Core Features & Use Cases

  • Unified Testing Strategy: Outlines when to reach for Vitest+RTL for React components and hooks, when to run Jest for backend use cases, and when to validate flows end-to-end with Playwright.
  • AAA Enforcement: Prescribes Arrange-Act-Assert structure with explicit naming for inputs, mocks, actuals, and expectations to keep every test readable and focused on behavior.
  • Object Mothers & Coverage Example: Encourages reusable *-mother.ts factories for inputs and entities while citing scenarios like duplicate resource creation and mandates 100% use case coverage with integration tests for controllers and infrastructure.

Quick Start

Use testing-patterns to plan AAA-compliant unit and integration tests for the new resource use case with Object Mother factories and Jest/Vitest coverage expectations.

Frequently Asked Questions about testing-patterns

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

FAQPage Schema
How do I structure unit tests for a NestJS backend and React frontend in an NX monorepo?▼

Structure unit tests for an NX monorepo using the Arrange-Act-Assert pattern with explicit naming for inputs, mocks, and expectations to keep frontend and backend tests readable and behavior-focused.

What testing frameworks should I use for SaaS React components versus NestJS use cases?▼

Use Vitest with React Testing Library for React components and hooks, run Jest for backend NestJS use cases, and validate complete user flows end-to-end with Playwright to ensure 100% use case coverage.

How do Object Mother factories improve test coverage for integration tests?▼

Object Mother factories improve integration test coverage by providing reusable *-mother.ts files that generate consistent test inputs and domain entities, ensuring deterministic repository wiring and predictable test scenarios.

When should I use Given-When-Then testing patterns in my SaaS application?▼

Use Given-When-Then testing patterns when validating end-to-end flows with Playwright or writing integration tests for controllers and infrastructure to ensure tests align with domain expectations and business requirements.

How do I achieve 100% use case coverage mandates for duplicate resource creation scenarios?▼

Achieve 100% use case coverage by writing integration tests for controllers and infrastructure using Object Mother factories to simulate duplicate resource creation, ensuring deterministic repository wiring and comprehensive scenario validation.

Do I need repository seeding helpers to write deterministic tests with Vitest and Jest?▼

Yes, repository seeding helpers are required alongside Jest, Vitest+RTL, and Playwright tooling to establish deterministic repository wiring and guarantee predictable test execution across all modules.