api-testing

Automate Vitest-based API tests for Hono routes and middleware.

21|2|Updated Nov 5, 2023
One-click install
npx skills add https://github.com/sgcarstrends/sgcarstrends --skill api-testing-sgcarstrends
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-testing
Source: https://github.com/sgcarstrends/sgcarstrends/tree/main/.claude/skills/api-testing
Command: npx skills add https://github.com/sgcarstrends/sgcarstrends --skill api-testing-sgcarstrends

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill equips you to write and run API tests for endpoints, middleware, and integrations, ensuring request/response integrity and resilience.

Core Features & Use Cases

  • Vitest-based tests for Hono-based API routes.
  • Endpoint coverage for routes, middleware, and authentication.
  • CI-ready structure with setup, helpers, and route tests.

Quick Start

Create a basic test that validates the /health endpoint returns 200.

Frequently Asked Questions about api-testing

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

FAQPage Schema
How do I test API endpoints with Vitest?

Vitest lets you write and run API endpoint tests with Node environment support, TypeScript, and ES modules. Create tests that validate request/response integrity, status codes, and middleware behavior for your Hono-based routes using a CI-ready structure with setup helpers and organized test layouts.

Can I test authentication and middleware in my API with Vitest?

Yes, Vitest supports testing authentication, authorization, and middleware layers within your API routes. You can validate that endpoints enforce proper access controls, middleware chains execute correctly, and requests are authenticated before proceeding.

What should I test in my API: endpoints, routes, or middleware?

API testing covers endpoints, routes, middleware, integrations, and background jobs. Validate request/response handling, error codes, authentication enforcement, rate limiting, caching behavior, data persistence, and health checks to ensure your API behaves correctly under normal and edge-case conditions.

How do I set up API tests for a Hono service?

Configure Vitest with Node environment and TypeScript support, then organize tests into directories for setup, helpers, routes, middleware, and workflows. Write tests that validate health endpoints, data persistence, and integration points to ensure your Hono API functions reliably.

Does Vitest provide coverage reporting for API tests?

Yes, Vitest includes built-in coverage reporting to track which endpoints, middleware, and error paths are tested. This helps identify gaps in your API test suite and ensures comprehensive validation of request/response flows and edge cases.

Can I test rate limiting and caching with API tests?

Yes, API tests can validate rate limiting enforcement and caching behavior by making sequential requests and checking response headers, status codes, and data consistency. Vitest's structured test layout supports these integration scenarios.