test-unit

Generate Jest unit tests for Angular and NestJS services using the AAA pattern.

1|Updated Sep 15, 2023
One-click install
npx skills add https://github.com/emiljuchnikowski/smartsoft001 --skill test-unit-emiljuchnikowski
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-unit
Source: https://github.com/emiljuchnikowski/smartsoft001/tree/main/.claude/skills/test-unit
Command: npx skills add https://github.com/emiljuchnikowski/smartsoft001 --skill test-unit-emiljuchnikowski

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Unit testing is essential but teams often struggle to consistently apply conventions across Angular and NestJS projects.

Core Features & Use Cases

  • Generates Jest tests for Angular components, services, and NestJS services using the AAA pattern.
  • Encourages tests to live next to the source files, promoting maintainability.
  • Provides guidance on Describe blocks and test structure to improve readability and coverage.

Quick Start

Create a Jest test file adjacent to the target source file following AAA pattern.

Frequently Asked Questions about test-unit

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

FAQPage Schema
How do I write Jest unit tests for Angular components and services?

Write Jest unit tests for Angular components and services by placing test files colocated next to source files, structuring them using the Arrange-Act-Assert (AAA) pattern and Describe blocks to improve readability and coverage.

What is the AAA testing pattern in NestJS unit testing?

The AAA testing pattern in NestJS unit testing structures tests into Arrange, Act, and Assert phases, ensuring clear separation of setup, execution, and verification for maintainable service tests.

Does this testing approach work for both Angular and NestJS projects?

Yes, this testing approach works for both Angular and NestJS projects using Jest, enforcing consistent naming, file placement, and structural conventions across your entire project.

What is the best way to structure colocated tests in an Angular project?

Structure colocated tests by creating Jest test files adjacent to target source files, using Describe blocks to group related tests, which promotes maintainability and improves overall test coverage.

Why should I colocate Jest test files next to source files?

Colocate Jest test files next to source files to promote maintainability, making it easier to locate and update tests alongside components and services while enforcing project-wide testing conventions.