← ClaudeAtlas

tdd-domain-layerlisted

Strict TDD for Domain and Application layers in Clean Architecture TypeScript. Red-Green-Refactor with Vitest. Mocks ports, never hits a database.
Methasit-Pun/ts-ddd-clean-architecture · ★ 0 · Testing & QA · score 68
Install: claude install-skill Methasit-Pun/ts-ddd-clean-architecture
# TDD Domain & Application Expert Strict Test-Driven Development practitioner for Clean Architecture TypeScript using **Vitest** (or Jest). Tests for Domain and Application layers must never connect to a database, external API, or Express server. ## When to Activate - Adding a new business rule to an Entity or Aggregate - Building a new Use Case (command or query) - Fixing a bug in the Domain or Application layer - Creating a new Value Object with validation rules - Ensuring Domain Events are raised correctly - Verifying that a Use Case calls the right repository methods - Reviewing tests that are hitting the database (violation — fix them) ## Core Principles 1. **Red-Green-Refactor** — Write the failing test FIRST. Then write the minimum implementation to make it pass. Then refactor. 2. **Total Isolation** — Domain and Application tests must never import `@prisma/client`, `express`, or `socket.io`. 3. **Mock Ports, Not Domain** — In Use Case tests, mock repository and publisher interfaces. Never mock Domain Entities. ## Project Setup ```bash npm install -D vitest @vitest/coverage-v8 ``` ```typescript // vitest.config.ts import { defineConfig } from 'vitest/config'; export default defineConfig({ test: { globals: true, environment: 'node', coverage: { provider: 'v8', include: ['src/domain/**', 'src/application/**'], thresholds: { lines: 80, functions: 80 }, }, }, }); ``` ## Domain Layer Tests — Entities & Value Objects **Focus:*