jest-nestjs

Write unit and end-to-end tests for NestJS applications using Jest.

Updated Jan 26, 2023
One-click install
npx skills add https://github.com/avvale/aurora-back --skill jest-nestjs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jest-nestjs
Source: https://github.com/avvale/aurora-back/tree/main/.claude/skills/jest-nestjs
Command: npx skills add https://github.com/avvale/aurora-back --skill jest-nestjs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the process of writing effective unit and end-to-end tests for NestJS applications, ensuring code quality and maintainability.

Core Features & Use Cases

  • Unit Testing: Write isolated tests for handlers, services, and aggregates.
  • E2E Testing: Test complete API flows for REST and GraphQL endpoints.
  • Mocking: Easily mock NestJS dependencies like repositories and services.
  • Use Case: When developing a new feature in your NestJS application, use this Skill to generate comprehensive unit tests for your new command handlers and mock the necessary repository dependencies.

Quick Start

Use the jest-nestjs skill to write a unit test for the CreateTeslaCommand handler.

Frequently Asked Questions about jest-nestjs

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

FAQPage Schema
How do I mock dependencies when unit testing NestJS handlers with Jest?

NestJS unit testing with Jest uses this skill's patterns to mock dependencies like repositories and services. It provides best practices for isolating command handlers and controllers to ensure robust, maintainable test suites without external calls.

How do I set up end-to-end testing for NestJS REST and GraphQL APIs?

End-to-end testing for NestJS REST and GraphQL APIs uses Jest configurations provided by this skill to test complete API flows. It validates request and response cycles across handlers and resolvers to ensure full endpoint functionality.

What is the best way to test CQRS aggregates and value objects in a NestJS application?

Testing CQRS aggregates and value objects in a NestJS application uses Jest unit testing patterns from this skill. It validates isolated domain logic and handler behaviors to ensure robust testing strategies for complex CQRS structures.

Does this Jest testing skill work with Aurora projects?

This Jest testing skill works with Aurora projects by providing specific Jest configurations and testing patterns. It aligns NestJS application unit and E2E testing setups with Aurora project architecture requirements to ensure compatible test environments.

Why do I need to mock NestJS repositories during unit testing?

You need to mock NestJS repositories during unit testing to isolate component logic from external data sources. This skill demonstrates how to mock these dependencies, ensuring tests remain fast, reliable, and focused on handler behavior.