Loading...
Loading...
Integration and contract testing patterns — API endpoint tests, component integration, database testing, Pact contract verification, property-based testing, and Zod schema validation. Use when testing API boundaries, verifying contracts, or validating cross-service integration.
npx skill4agent add yonatangross/orchestkit testing-integration| Area | Rule / Reference | Impact |
|---|---|---|
| Stateful API testing (emulate) | | HIGH |
| API endpoint tests | | HIGH |
| React component integration | | HIGH |
| Database layer testing | | HIGH |
| Zod schema validation | | HIGH |
| Pact contract testing | | MEDIUM |
| Stateful testing (Hypothesis) | | MEDIUM |
| Evidence & property-based | | MEDIUM |
| Topic | File |
|---|---|
| Consumer-side Pact tests | |
| Pact Broker CI/CD | |
| Provider verification setup | |
| Hypothesis strategies guide | |
| Checklist | File |
|---|---|
| Contract testing readiness | |
| Property-based testing | |
| Script | File |
|---|---|
| Create integration test | |
| Test plan template | |
| Example | File |
|---|---|
| Full testing strategy | |
| Tool | Best For |
|---|---|
| emulate | Stateful API tests (GitHub/Vercel/Google) — FIRST CHOICE |
| Pact | Cross-team contract verification |
| MSW | Frontend HTTP mocking (simple request/response) |
| Nock | Node.js unit-level HTTP interception |
rules/emulate-stateful-testing.mdimport request from 'supertest';
import { app } from '../app';
describe('POST /api/users', () => {
test('creates user and returns 201', async () => {
const response = await request(app)
.post('/api/users')
.send({ email: 'test@example.com', name: 'Test' });
expect(response.status).toBe(201);
expect(response.body.id).toBeDefined();
expect(response.body.email).toBe('test@example.com');
});
test('returns 400 for invalid email', async () => {
const response = await request(app)
.post('/api/users')
.send({ email: 'invalid', name: 'Test' });
expect(response.status).toBe(400);
expect(response.body.error).toContain('email');
});
});import pytest
from httpx import AsyncClient
from app.main import app
@pytest.fixture
async def client():
async with AsyncClient(app=app, base_url="http://test") as ac:
yield ac
@pytest.mark.asyncio
async def test_create_user(client: AsyncClient):
response = await client.post(
"/api/users",
json={"email": "test@example.com", "name": "Test"}
)
assert response.status_code == 201
assert response.json()["email"] == "test@example.com"| Area | Target |
|---|---|
| API endpoints | 70%+ |
| Service layer | 80%+ |
| Component interactions | 70%+ |
| Contract tests | All consumer-used endpoints |
| Property tests | All encode/decode, idempotent functions |
Like()EachLike()Term().safeParse()ork:testing-unitork:testing-e2eork:emulate-seedork:database-patternsork:api-design