generate-test

Generates Vitest unit test files for Angular components, services, pipes, and utilities in Lucca Front.

52|7|Updated Apr 12, 2017
One-click install
npx skills add https://github.com/LuccaSA/lucca-front --skill generate-test-luccasa
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: generate-test
Source: https://github.com/LuccaSA/lucca-front/tree/main/.claude/skills/generate-test
Command: npx skills add https://github.com/LuccaSA/lucca-front --skill generate-test-luccasa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing unit tests that match a repository's specific conventions is slow and error-prone. This Skill generates *.spec.ts files for Lucca Front code that follow the repo's exact testing setup (Vitest, TestBed, happy-dom, signal-based APIs) so tests pass on the first run and stay consistent with neighboring specs. ## Core Features & Use Cases - Pattern-based test generation: Selects the right testing pattern based on the target type — pure function, pipe, service, HTTP service, component, or directive. - Repo convention compliance: Uses fixture.componentRef.setInput for signal inputs, host component wrappers, HttpTestingController for HTTP services, and UTC-safe date handling. - Behavioral test focus: Produces tests that assert observable behavior and public contracts rather than volatile implementation details. - Use Case: You just wrote a new pipe in packages/ng and need tests. The Skill reads the pipe's source, identifies its dependencies, writes a spec file next to it, and runs npx vitest run to verify it passes. ## Quick Start Generate unit tests for the component in packages/ng/button/button.component.ts following the repository conventions.

Frequently Asked Questions about generate-test

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

FAQPage Schema
How do I write unit tests for an Angular component with signal inputs?▼

Create a host component that binds the target's inputs in its template, then drive changes with fixture.componentRef.setInput('name', value) followed by fixture.detectChanges(). Never assign signal input properties directly on the component instance.

How to test an Angular service that uses HttpClient with Vitest?▼

Configure TestBed with provideHttpClient() and provideHttpClientTesting(), inject HttpTestingController, then use expectOne() to match requests and flush() to return mock responses. Call httpMock.verify() in afterEach to ensure no pending requests remain.

Can I test an Angular pipe without TestBed?▼

Yes, pure pipes without injected dependencies can be instantiated directly with new and tested by calling transform(). Pipes depending on injection tokens or LOCALE_ID should be tested inside a template via a host component instead.

Why do Angular date tests fail in different timezones?▼

Date assertions fail when the test environment timezone differs from CI. This repository forces TZ=UTC, so construct dates deterministically with explicit UTC strings like new Date('2024-01-01T00:00:00.000Z') to keep assertions stable.

What should unit tests avoid asserting in Angular components?▼

Avoid coupling tests to volatile implementation details like private method call order, internal DOM structure, or private properties. Assert observable behavior such as return values, rendered text, and public contract effects that survive refactoring.