home/productivity/test-suite-prompt

Test Suite.prompt

GPTClaudeDeepSeek··668 copies·updated 2026-07-14
test-suite-prompt.prompt
# Phase 3 — Test suite

## Context to read before starting
- `.cursorrules`
- `context/06-testing.md`

Phases 1 and 2 are complete. Production code exists.

---

## Task

Implement the complete test suite. Follow the exact order and cases from `context/06-testing.md`.

---

## Implementation order

### 1. Jest configuration
- [ ] `jest.config.ts` with coverage thresholds: statements 85%, branches 80%, functions 90%
- [ ] `jest.setup.ts` with global setup if needed
- [ ] Scripts in `package.json`:
  - `test` — all tests
  - `test:unit` — unit only
  - `test:integration` — integration only
  - `test:concurrent` — concurrency only
  - `test:coverage` — with HTML report

---

### 2. Unit tests — test/unit/

All cases from the "Unit tests" section of `context/06-testing.md`.

Files to create:
- `test/unit/balance.service.spec.ts`
- `test/unit/requests.service.spec.ts`
- `test/unit/sync.service.spec.ts`
- `test/unit/hcm-client.service.spec.ts`

Rules:
- Mock TypeORM repositories with `jest.fn()`
- Mock HcmClientService with `jest.fn()`
- Do not boot any server

---

### 3. Integration tests — test/integration/

All cases from the "Integration tests" section of `context/06-testing.md`.

Files to create:
- `test/integration/requests.integration.spec.ts`
- `test/integration/balance.integration.spec.ts`
- `test/integration/sync.integration.spec.ts`

Rules:
- In-memory SQLite: `{ type: 'better-sqlite3', database: ':memory:' }`
- Boot real NestJS app with `Test.createTestingModule()`
- HcmClientService mocked with `jest.fn()`
- `beforeEach`: clean all tables
- `afterAll`: close app

---

### 4. Mock HCM tests — test/mock-hcm/

All cases from the "Mock HCM tests" section of `context/06-testing.md`.

Files to create:
- `test/mock-hcm/mock-hcm.module.ts`
- `test/mock-hcm/mock-hcm.controller.ts`
- `test/mock-hcm/mock-hcm.service.ts`
- `test/mock-hcm/mock-hcm.helpers.ts`
- `test/mock-hcm/hcm-resilience.spec.ts`

Mock server uses `X-Mock-Scenario` header to control behavior.
See scenario table in `context/06-testing.md`.

---

### 5. Concurrency tests — test/concurrent/

All cases from the "Concurrency tests" section of `context/06-testing.md`.

File to create:
- `test/concurrent/race-conditions.spec.ts`

Rules:
- Use `Promise.all()` to fire concurrent calls
- Validate final DB state, not only HTTP status
- The 10-request test must verify exactly 3 ended in `PENDING`

---

## When finished

Run `npm run test:coverage` and confirm thresholds are met.
Share the coverage summary.
Do not continue to Phase 4 until minimum coverage is reached.

fill the variables

This prompt has 1 variable. Pro fills them into a ready-to-paste prompt for you — no manual find-and-replace.

{type: 'better-sqlite3', database: ':memory:'}
Unlock with Pro →

when to use it

Community prompt sourced from the open-source GitHub repo JuniRanger/time-off-microservice (no explicit license). A "Test Suite.prompt" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

productivitycommunitydeveloper

source

JuniRanger/time-off-microservice · no explicit license