com um clique
generating-api-tests
// Reads API_Contracts.md and generates failing Vitest integration tests for the expected Next.js Route Handlers. Use when generating API tests for TDD.
// Reads API_Contracts.md and generates failing Vitest integration tests for the expected Next.js Route Handlers. Use when generating API tests for TDD.
Compares a modernized Next.js application against its legacy Express counterpart using runtime side-by-side verification. Use when ensuring functional and business logic parity between two systems.
Manages the end-to-end modernization of legacy Express monoliths into Next.js architectures. Orchestrates subagents for auditing, scaffolding, and verification. Use when starting or managing a greenfield rewrite project.
Systematically probe a modernized Next.js application for logic flaws, security vulnerabilities, or missing features. Use this to find bugs or cases where the migration failed to match legacy behavior.
Analyzes Express route definitions and controller logic to document API endpoints, payloads, and response structures. Use when reverse-engineering an existing Express application's API surface.
Analyzes authentication flows, authorization rules, middleware logic, and side-effects. Use when extracting business rules, Passport configurations, or mailer logic from an Express application.
Analyzes legacy ORM models (Mongoose, Sequelize) to extract schemas, validations, and relationships. Use when reverse-engineering a legacy data layer for a modern rewrite.
| name | generating-api-tests |
| description | Reads API_Contracts.md and generates failing Vitest integration tests for the expected Next.js Route Handlers. Use when generating API tests for TDD. |
Implement Test-Driven Development (TDD) by writing strict tests asserting the exact behaviors, payloads, and JSON responses defined in the legacy Express APIs.
Copy this checklist and track your progress:
Task Progress:
- [ ] Step 1: Read the API Contracts
- [ ] Step 2: Generate Auth/User Tests
- [ ] Step 3: Generate Article/Comment Tests
Locate and read docs/legacy-audit/API_Contracts.md and docs/legacy-audit/Business_Logic_Rules.md.
Create a tests/api folder. For each distinct domain in the contracts (e.g., users.test.ts, articles.test.ts), write a Vitest suite.
Use node-mocks-http to construct the Request and capture the Next.js NextResponse JSON output. Assert that the required HTTP status codes (200, 201, 401, 404, 422) and JSON body structures match the original Express requirements.
Crucial Note: These tests WILL FAIL initially. That is the point of TDD. They will be executed repeatedly during the Data and API scaffolding phases until they pass.