testing

Guide unit, integration, and UI tests across Clean Architecture layers with layer-specific mocks.

Updated Jan 20, 2026
One-click install
npx skills add https://github.com/jmgomezdev/itx-mobile-shop --skill testing-jmgomezdev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/jmgomezdev/itx-mobile-shop/tree/main/.github/skills/testing
Command: npx skills add https://github.com/jmgomezdev/itx-mobile-shop --skill testing-jmgomezdev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Testing across a software project often lacks consistent guidance on where to place tests and how to structure mocks per architectural layer. This Skill codifies layer-specific testing strategies aligned with Clean Architecture to guide Domain, Application, Infrastructure, and Presentation testing considerations.

Core Features & Use Cases

  • Domain Layer (src/domain): Type: Pure Unit Tests. Mocks: ❌ NONE. Focus: validate business logic, input schemas (e.g., .parse()), and small utilities.
  • Application Layer (src/application): Type: Unit Tests. Mocks: ✅ Mock Infrastructure Repositories and Zustand Stores. Focus: test query options, complex hook logic, and state mutations.
  • Infrastructure Layer (src/infrastructure): Type: Integration Tests. Mocks: ✅ Mock HTTP; Focus: verify repositories call endpoints, map DTOs to domain entities, and validate API shapes.
  • Presentation Layer (src/presentation): Type: Component Integration Tests. Mocks: ✅ Mock Application Layer Hooks. Forbidden: ❌ Never mock axios, fetch, or useQuery directly in components. Focus: test UI rendering across data states, interactions, and accessibility.

Quick Start

Describe and enforce layer-specific testing strategies across domain, application, infrastructure, and presentation layers during development.

Frequently Asked Questions about testing

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

FAQPage Schema
How do I structure unit tests and integration tests across Clean Architecture layers?

Structure tests by architectural layer: pure unit tests for Domain logic, mocked unit tests for Application logic, integration tests for Infrastructure repositories, and component integration tests for the Presentation layer. This ensures test suites remain maintainable and correctly scoped per layer.

Do I need to mock repositories and stores when testing the application layer?

Yes, when testing the application layer, you should mock Infrastructure Repositories and Zustand Stores. This isolates complex hook logic, query options, and state mutations, ensuring your tests validate application behavior without triggering actual infrastructure or network calls.

What is the best way to test domain layer business logic without external dependencies?

The best way to test domain layer business logic is using pure unit tests with zero mocks. Validate business logic and input schemas directly, such as calling `.parse()`, to ensure core utilities function correctly without any external dependencies or side effects.

Can I mock fetch or axios directly inside presentation layer component tests?

Never mock axios, fetch, or useQuery directly inside presentation layer component tests. Instead, mock the Application Layer Hooks to test UI rendering across data states, user interactions, and accessibility while maintaining proper Clean Architecture boundaries.

Why do infrastructure layer tests need to mock HTTP instead of using pure unit tests?

Infrastructure layer tests use integration tests with mocked HTTP to verify that repositories correctly call endpoints, map DTOs to domain entities, and validate API shapes. Pure unit tests cannot adequately verify these external integrations and data mapping behaviors.