testing-api-assertions

Verify captured API requests for method, path, payload in tests.

163|22|Updated May 22, 2025
One-click install
npx skills add https://github.com/stacklok/toolhive-studio --skill testing-api-assertions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-api-assertions
Source: https://github.com/stacklok/toolhive-studio/tree/main/.cursor/skills/testing-api-assertions
Command: npx skills add https://github.com/stacklok/toolhive-studio --skill testing-api-assertions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Verify API requests in tests to ensure correct backend interactions.

Core Features & Use Cases

  • Request verification: Assert that tests trigger the expected API calls (method, path, and payload) for create, update, or delete actions.
  • End-to-end mutation checks: Validate that UI actions produce the intended backend mutations and side effects.
  • Use Case: In a UI test, verify that submitting a form results in a POST to /api/v1beta/resources with the expected payload.

Quick Start

In your test setup, enable request recording with the testing utility (e.g., recordRequests()), perform the user action, then assert that the captured requests include the expected POST/PUT/DELETE to the correct endpoints with the right payload.

Frequently Asked Questions about testing-api-assertions

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

FAQPage Schema
How do I verify API requests in tests to ensure correct backend interactions?

Verify API requests in tests by capturing them with recordRequests(), performing the user action, then asserting the captured method, path, and payload match the expected backend calls.

What is the best way to test that form submissions trigger the correct API mutations?

Test form submissions by recording API requests during the UI action, then asserting the captured requests include the expected POST, PUT, or DELETE operations to the correct endpoints with the right payload.

How do I assert the payload of a POST request in a backend test?

Assert the POST request payload by recording the API call during the test, then comparing the captured request's method, path, and body payload against the expected data structure and values.

Can I use recordRequests() to validate end-to-end mutations and side effects?

Yes, use recordRequests() to capture API calls during UI tests, allowing you to validate that user actions produce the intended backend mutations and side effects by asserting on the recorded requests.

When do I need to verify API requests in my tests?

Verify API requests in tests involving create, update, and delete operations, mutations, and form submissions where backend state changes, ensuring UI actions trigger the expected API calls.

Does request verification work for both UI and backend tests?

Request verification works for tests involving create, update, and delete operations, mutations, and form submissions, capturing API calls to assert correct method, path, and payload for backend interactions.