MindFlow’s test suites are organized in a Jest multi-project monorepo. The rootDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/J0S3-LEON/pf_pruebasAseguramientoCalid_SDD/llms.txt
Use this file to discover all available pages before exploring further.
jest.config.js delegates to per-workspace configurations — apps/backend, apps/frontend, and packages/shared — so you can run everything at once from the repo root, or target a single workspace for faster feedback during development. The sections below cover every command you need, from a full suite run to a single spec file.
All test commands
Test file patterns
Jest discovers tests by filename pattern. Each category uses a distinct suffix so you can target or exclude entire categories with--testPathPattern.
| Category | File pattern | Description |
|---|---|---|
| Unit tests | *.service.spec.ts, *.controller.spec.ts | Single service or controller in isolation with mocked dependencies |
| Property-based tests | *.property.spec.ts | fast-check properties run with numRuns ≥ 5 (100 for non-async) |
| Smoke tests | *.smoke.spec.ts | Static config validation — Dockerfile, Prisma schema, compose.yml |
| Integration tests | integration/*.latency.spec.ts | DB writer latency over 10 mocked writes; validates Prisma pool config statically |
Running a single spec file
Target any spec file directly withnpx jest and its workspace-relative path:
Running tests by pattern
Use--testPathPattern to select all files whose path matches a substring:
Environment setup for integration tests
The latency spec (To also validate pool settings against a live database URL, set
__tests__/integration/db-writer.latency.spec.ts) uses a mocked PrismaService — no real PostgreSQL connection is required. If DATABASE_URL is available in the environment the Prisma pool config test will read it directly; if it is absent, the test falls back to validating the documented reference URL string.DATABASE_URL before running:Smoke tests are DB-independent
Smoke tests validate static configuration artifacts only — they do not connect to PostgreSQL, spin up Docker containers, or load environment variables. You can run them on any machine, including a bare CI runner with no infrastructure:Smoke tests check:
compose.yml service definitions, absence of hardcoded secrets in the backend container config, Prisma schema pool settings (connection_limit=10, pool_timeout), and the mindflow_pgdata named volume declaration.Parallel vs. sequential execution
What a passing PBT run looks like
When all properties pass, fast-check is silent in the Jest output — you see the standard green checkmark for eachit block. When a property fails, fast-check prints a detailed report before throwing:
- seed — use this value with
{ seed: 1837462910 }to reproduce the exact same sequence - path — the position in fast-check’s internal shrink tree where the minimal counterexample was found
- Counterexample — the smallest input that still triggers the failure (fast-check shrinks automatically)
- Shrunk N time(s) — how many shrink steps were taken to reach the minimal example
Latency test behavior
Latency tests (
__tests__/integration/db-writer.latency.spec.ts) measure the time for 10 consecutive DBWriterService.writeSession() calls through an in-memory mocked PrismaService that resolves immediately. Because there is no real I/O, average latency will be close to 0 ms — well under the 3 000 ms threshold required by Requirement 3.3. The purpose is to verify that the DBWriterService code path introduces no inherent latency overhead and that the service returns structurally correct results for all 10 calls.The same spec also validates Prisma connection pool configuration statically (pool connection_limit=10, pool_timeout=20), without opening any real database connection.