knofler/myai/integration-test-write

Claude Code and agent skill by knofler/myai

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Write integration tests for API endpoints — test full request-response cycle with database, fixtures, and cleanup. Triggers: integration test, API test, endpoint test, supertest, test API

Install

npx vskill@latest install knofler/myai/integration-test-write

SKILL.md

The same SKILL.md was published earlier as knofler/myai/integration-test-write.

Integration Test Write

Write integration tests that exercise API endpoints through the full stack.

Tech Stack

Supertest | Jest/Vitest | MongoDB (Docker or in-memory) | factory fixtures

Playbook

1. Set up test database
  • Use Docker Compose or mongodb-memory-server for isolation.
  • Configure .env.test with dedicated connection string.
  • Connect in beforeAll, disconnect in afterAll.
2. Create test fixtures
  • Build factory functions for test data with unique identifiers.
typescript
function createUserFixture(overrides = {}) {
return { name: 'Test User', email: `test-${Date.now()}@example.com`, ...overrides };
}
3. Initialize the app for testing
  • Import the app without calling listen(). Pass to Supertest.
typescript
import app from '../src/app';
import request from 'supertest';
const agent = request(app);
4. Test full request-response cycle
typescript
it('should create a user and return 201', async () => {
const res = await agent
.post('/api/users')
.send({ name: 'Alice', email: 'alice@test.com' })
.expect(201);
expect(res.body).toHaveProperty('id');
});
5. Verify database state
  • Query the database directly to confirm writes.
  • Check cascading effects, computed fields, and timestamps.
6. Test auth and error scenarios
  • Verify 401 for unauthenticated, 403 for unauthorized requests.
  • Test invalid body (400), not found (404), conflict (409).
  • Confirm consistent error response format.
7. Clean up after each test
typescript
afterEach(async () => { await User.deleteMany({}); });
  • Ensure tests can run in any order with no shared state.
8. Run and verify
  • Run: npx vitest run tests/integration.
  • Confirm all endpoints are covered and assertions are meaningful.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/knofler/myai/integration-test-write/badge)](https://verified-skill.com/skills/knofler/myai/integration-test-write)

Something wrong with this skill or its page? Tell us.