From test-builder
Generate integration tests that verify component interactions — API routes, database queries, service layers
npx claudepluginhub silviaare95/xari-plugins --plugin test-builderThis skill uses the workspace's default tool permissions.
Guides reliable browser automation using Playwright and Puppeteer for web testing, scraping, and AI agent interactions. Covers selectors, waits, isolation, and anti-detection patterns.
Provides checklists to review code for functionality, quality, security, performance, tests, and maintainability. Use for PRs, audits, team standards, and developer training.
Enforces A/B test setup with gates for hypothesis locking, metrics definition, sample size calculation, assumptions checks, and execution readiness before implementation.
Generate integration tests for: $0
Framework: $1 (default: vitest)
Identify the integration boundary — What components are being tested together?
Set up test infrastructure:
Design test scenarios:
Write tests:
import { describe, it, expect, beforeAll, afterAll, beforeEach } from "vitest";
import { prisma } from "@/lib/prisma";
import { createTestUser, cleanupTestData } from "./helpers";
describe("POST /api/orders", () => {
let testUser: User;
beforeAll(async () => {
testUser = await createTestUser();
});
afterAll(async () => {
await cleanupTestData();
});
beforeEach(async () => {
await prisma.order.deleteMany({ where: { userId: testUser.id } });
});
it("creates an order and updates inventory", async () => {
const response = await fetch("/api/orders", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${testUser.token}`,
},
body: JSON.stringify({ productId: "prod_1", quantity: 2 }),
});
expect(response.status).toBe(201);
const order = await prisma.order.findFirst({
where: { userId: testUser.id },
});
expect(order).toBeDefined();
expect(order?.quantity).toBe(2);
const product = await prisma.product.findUnique({
where: { id: "prod_1" },
});
expect(product?.stock).toBe(initialStock - 2);
});
it("returns 400 when quantity exceeds stock", async () => {
const response = await fetch("/api/orders", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${testUser.token}`,
},
body: JSON.stringify({ productId: "prod_1", quantity: 99999 }),
});
expect(response.status).toBe(400);
const body = await response.json();
expect(body.code).toBe("INSUFFICIENT_STOCK");
});
});
createTestUser() — seed a user with auth tokencleanupTestData() — tear down test dataseedDatabase() — populate required reference data__tests__/integration/ or alongside the featureafterAll/afterEach — don't leave state between tests