integration-tests

Write integration tests for NestJS APIs with supertest and frontend features with MSW.

Updated Apr 7, 2026
One-click install
npx skills add https://github.com/hontauadrian/sfx-app-empty-test --skill integration-tests-hontauadrian
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: integration-tests
Source: https://github.com/hontauadrian/sfx-app-empty-test/tree/main/.overstory/claude-profiles/merger/skills/integration-tests
Command: npx skills add https://github.com/hontauadrian/sfx-app-empty-test --skill integration-tests-hontauadrian

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Unit tests with mocked dependencies cannot prove that modules are wired together correctly, that HTTP endpoints return proper status codes, or that frontend data flows work end to end. This Skill provides patterns for writing true integration tests that exercise real module graphs and network-level behavior. ## Core Features & Use Cases - API Integration Testing: Patterns for testing NestJS modules with supertest and TestingModule, covering CRUD roundtrips, validation errors, auth guards, and cross-module interactions. - Frontend Integration Testing: Patterns for testing React hooks and data layers with MSW and Testing Library, intercepting real HTTP calls at the network level. - Test Checklists: Concrete scenario tables covering status codes (400, 401, 404, 500), roundtrips, error propagation, and empty states. - Use Case: After creating a new Task API module, use this Skill to generate integration tests that verify POST creates a record, GET reads it back, DELETE removes it, and invalid input returns 400. ## Quick Start Write integration tests for my new NestJS task module covering create, read, delete roundtrips and validation error cases.

Frequently Asked Questions about integration-tests

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

FAQPage Schema
How do I write integration tests for a NestJS API?▼

Use Test.createTestingModule with the real AppModule, create the app with createNestApplication, and send requests via supertest against app.getHttpServer(). Test CRUD roundtrips, validation errors returning 400, and 404s for missing resources.

How to test React hooks that call APIs with MSW?▼

Set up an MSW server with setupServer and http handlers that intercept real fetch calls, then use renderHook from Testing Library with a QueryClientProvider wrapper. Override handlers per test with server.use to simulate errors and empty responses.

What is the difference between unit tests and integration tests?▼

Unit tests mock dependencies and test one layer in isolation, while integration tests import real modules and verify multiple layers work together. Integration tests prove controller-to-database wiring and hook-to-API data flow actually function.

Do NestJS integration tests prove the server works in production?▼

No. TestingModule runs in-process without a real port, so it cannot verify server boot, route registration on a real listener, middleware pipelines, or CORS configuration. Runtime verification against a live server is required for those guarantees.

Should I mock the service layer in integration tests?▼

No. Mocking internal services or repositories turns the test into a unit test. Only mock external boundaries, such as using MSW for frontend HTTP calls, and never mock anything in API integration tests.