test-scaffold

Generate Jest and Vitest unit tests for NestJS services, RabbitMQ consumers, gRPC controllers, React hooks, Zustand stores, and Zod schemas.

Updated Apr 6, 2026
One-click install
npx skills add https://github.com/lety-ai/lety-skill-hub --skill test-scaffold-lety-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-scaffold
Source: https://github.com/lety-ai/lety-skill-hub/tree/main/plugins/test-scaffold/skills/test-scaffold
Command: npx skills add https://github.com/lety-ai/lety-skill-hub --skill test-scaffold-lety-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Generates well-structured, production-quality unit tests for a full-stack TypeScript monorepo, reducing flaky tests and guidance gaps when developers need reliable coverage for services, consumers, controllers, hooks, stores, and schemas.

Core Features & Use Cases

  • Backend service tests: Generate Jest-based NestJS service specs with mocked repositories, DataSource transaction and QueryRunner handling, QueryBuilder chain mocks, and BaseRpcException assertions.
  • Message consumer tests: Validate RabbitMQ consumer handlers with ack/nack behavior and channel mocking for success and failure paths.
  • Frontend tests: Produce Vitest/RTL tests for React hooks, TanStack Query hooks, and Zustand stores, including renderHook usage, QueryClient wrappers, and schema validation tests for Zod.
  • Test scaffolding & factories: Create typed mock factories, clear beforeEach module setup, and flag existing anti-patterns to ensure best practices are followed.

Quick Start

Write unit tests for apps/notifications/notifications.service.ts covering findById, create, update, remove, and permission/error scenarios.

Frequently Asked Questions about test-scaffold

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

FAQPage Schema
How do I write unit tests for NestJS services with mocked DataSource transactions?

Generate Jest specs for NestJS services by mocking repository methods, DataSource transactions, and QueryRunner handling. Include QueryBuilder chain mocks and strict BaseRpcException assertions to validate permission and error scenarios.

How do I test RabbitMQ consumer handlers with ack and nack behavior?

Validate RabbitMQ consumers by mocking the channel and asserting ack/nack behavior across success and failure paths. Ensure unit tests cover message handler exceptions to guarantee reliable message processing.

What is the best way to test Zustand stores and React hooks using Vitest?

Use Vitest with renderHook and QueryClient wrappers for TanStack Query hooks to test Zustand stores. Generate specs that validate state changes and component integration while avoiding flaky asynchronous behavior.

Can I generate schema validation tests for Zod in a TypeScript monorepo?

Yes, generate Vitest specs that assert strict Zod schema parsing and validate error paths. Use typed mock factories to align schema validation tests with frontend hook scenarios in your monorepo.

Does this test scaffolding work with both Jest and Vitest?

Yes, it supports both Jest and Vitest. Generate backend NestJS specs using Jest and frontend React hook tests using Vitest, applying framework-specific best practices like clear beforeEach module setup and typed mock factories.

Why do my Vitest tests flag existing mock factories as anti-patterns?

Tests flag anti-patterns when mock factories lack proper typing or clear beforeEach module setup. Generate typed mock factories and review scaffolding to ensure Jest and Vitest best practices are strictly followed.