smithery.ai

test-database-feature

Run repository integration tests against a local MySQL database for the RAPID backend. Use after implementing new repository methods, modifying Prisma database schema, testing use cases that depend on database access, or verifying data access patterns.

First seen Mar 22, 2026

Installation

$ npx skills add https://smithery.ai

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery.ai · top by installs.

npx skills add https://smithery.ai

Browse all from smithery.ai

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,620 B
  • docs SUMMARY.md 87 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

Test Database Feature

Prerequisites

1. Start Local Database

docker-compose -f assets/local/docker-compose.yml up -d

Database: localhost:3306, DB: rapiddb, User: rapiduser, Password: rapid_password

2. Setup Prisma

cd backend
npm run prisma:generate
npm run prisma:migrate

Repository Integration Test Pattern

Repository tests MUST connect to actual database (not mocks).

import { describe, it, expect, beforeEach, afterAll } from 'vitest';
import { PrismaClient } from '@prisma/client';
import { makeYourRepository } from '../domain/repository';

const prisma = new PrismaClient();

describe('YourRepository Integration Tests', () => {
  beforeEach(async () => {
    await prisma.yourModel.deleteMany();
  });

  afterAll(async () => {
    await prisma.$disconnect();
  });

  it('should create and retrieve entity', async () => {
    const repo = makeYourRepository(prisma);
    const entity = { id: 'test-1', name: 'Test Entity' };

    await repo.storeEntity({ entity });
    const retrieved = await repo.findEntityById('test-1');

    expect(retrieved).not.toBeNull();
    expect(retrieved?.name).toBe('Test Entity');
  });
});

Test Organization

backend/src/api/features/{feature}/__tests__/
├── repository-integration.test.ts  # Database integration tests
├── usecase.test.ts                 # Use case unit tests (mocked repo)
└── handlers.test.ts                # Handler unit tests (mocked usecase)

Running Tests

cd backend
npm test                          # All tests
npm run test -- {test-name}       # Specific test suite
npm run test:watch                # Watch mode
npm run test:coverage             # With coverage

Quick Commands

Task Command
Start DB docker-compose -f assets/local/docker-compose.yml up -d
Stop DB docker-compose -f assets/local/docker-compose.yml down
Reset DB Add -v to down, then up + migrate
Run migrations cd backend && npm run prisma:migrate
Prisma Studio cd backend && npm run prisma:studio (http://localhost:5555)

Success Criteria

  • Docker container running
  • Migrations applied
  • All repository integration tests pass
  • Ready to run /build-and-format for final verification