name: improve-c7-1 description: Improve readiness criterion C7.1 (Test Isolation) in the current project by adding mocks, fixtures, or seed scripts. Raises the fulfillment level by one step. allowed-tools: Bash Read Write Edit
Improve C7.1 — Test Isolation
Current State
Examine the project to understand its current state:
- Check the dependency manifest and source files for any database or external API dependencies (to determine if C7.1 is applicable).
- Look for mock, stub, and fixture directories and files in the test tree.
- Look for seed scripts.
- Look for test-specific container configuration (docker-compose for tests, Testcontainers, etc.).
- Look for schema or model files that would be needed to generate seed data.
Instructions
Step 1 — Check applicability: If the project has no database and no external API dependencies (it's a pure library, CLI tool, or in-memory system), report "C7.1 is N/A for this project — no external dependencies detected" and stop.
Step 2 — Determine current level:
- Level 0: No isolation from external systems
- Level 1: In-code mocks/stubs and basic fixtures exist
- Level 2: Reproducible DB state via seed scripts + sandbox environments
Step 3 — Implement the improvement:
If current level is 0 → raise to 1: Add mock infrastructure appropriate to the detected stack:
Node.js/TypeScript with external APIs: Create
src/__mocks__/ortests/mocks/directory. Create mock files for each external dependency detected:- HTTP clients: create a Jest manual mock or use
msw(Mock Service Worker) for API mocking - Add
mswto devDependencies and createtests/mocks/handlers.tswith request handlers for detected external API calls - Create
tests/fixtures/with sample response JSON files for detected APIs
- HTTP clients: create a Jest manual mock or use
Node.js/TypeScript with DB: Create mock implementations for repository/data access classes if they exist. Add
jest.mock()calls in test setup.Python: Create
tests/fixtures/directory with fixture files. If using pytest, createtests/conftest.pywith fixtures usingunittest.mock.patchfor external dependencies.
Write at least one concrete mock/fixture for each detected external dependency.
If current level is 1 → raise to 2: Add reproducible database state:
Prisma: Create
prisma/seed.tsthat inserts representative test data for each model in the schema. Add"seed": "ts-node prisma/seed.ts"to package.json scripts and"prisma": { "seed": "..." }to package.json.TypeORM/Sequelize: Create
src/database/seeds/directory with seed files that create test data.Python/SQLAlchemy: Create
tests/fixtures/seed.pywith functions to populate a test database.Any project with a DB: Create
docker-compose.test.ymlthat spins up an isolated test database (Postgres, MySQL, Redis) on a different port from development, using in-memory or tmpfs storage where possible.
Base seed data on the actual models/schema detected in the project.
If already at level 2: Report that C7.1 is already at its maximum level (2) and no improvement is needed.
Step 4 — Report: State what files were created or modified, the before and after level.