Register all active platform services and base features in core DB so admin can manage them, add delivery/hospitality/sports-center backend phases, update apps catalog and production deploy tooling. Co-authored-by: Cursor <cursoragent@cursor.com>
3.5 KiB
3.5 KiB
Testing Template
Mandatory test categories for implementation phases.
Baseline strategy: testing-strategy.md.
Enterprise mandate: definition-of-done.md · ADR-018.
Mark a category N/A only with written justification (e.g. docs-only phase).
Unit
- Pure validators, mappers, permission helpers, specifications, policies, formatting, template rendering without I/O.
- Deterministic; no real network.
Repository
- Query correctness, pagination, filtering, sorting, searching.
- Soft-delete defaults.
- Tenant filter present on tenant-owned entities.
- Cross-tenant get/update returns empty/denied.
- Optimistic lock conflict behavior when versioning is used.
Service / Command / Query
- Business rules and invariants (commands).
- Read-side correctness without write side-effects (queries).
- Audit/event emission expectations (outbox rows or publisher fakes).
- Domain error codes for illegal transitions.
- Policy denials where policies are in scope.
Integration / API
- HTTP contracts: status codes, auth, permission denials.
- Tenant header requirements.
- Pagination / filter / sort / search query params.
- OpenAPI route presence for new endpoints (smoke or schema assertion when pattern exists).
- Health / capabilities / metrics when the phase owns them.
- End-to-end flows for the phase’s primary use cases.
Migration
- Upgrade applies on clean DB.
- Smoke query against new tables/columns.
- Seed data applies when required.
- Downgrade only if the service supports it — document if not.
Permission
- Each new privileged route denies without permission/role.
- Permission names match
{service}.*trees documented in the phase.
Security
- Unauthenticated access denied where required.
- Token scope / role bypass attempts fail.
- No secret leakage in error bodies.
Performance
- Required for hot paths (entitlement, routing, queue claim, posting, large lists) when the phase touches them.
- Otherwise document N/A.
- Avoid unbounded queries; assert basic index presence or acceptable timing in CI only when stable.
Tenant Isolation
- At least one cross-tenant denial per new tenant-scoped API/aggregate.
- No list endpoint returns other tenants’ rows.
Architecture / Boundary
- No forbidden imports across services.
- Layering rules (API thin; no business logic in repos).
- No future-phase modules accidentally introduced (when detectable).
- Follow sibling static checks used by CRM/Loyalty/Communication/platform services.
Documentation Validation
- Phase doc exists and matches delivered surface.
- Registry/manifest entries updated.
- Critical links resolve (tests or scripted checks when the service already has
test_docs/ architecture tests — follow sibling pattern). - DoD / completeness sections present in handover for implementation phases.
Phase Rules
- New behavior ships with tests in the same phase.
- Failing or missing required tests → phase incomplete.
- Do not use production data.
- Prefer fakes for OTP, SMS providers, time.
- CRUD-only test coverage without domain-rule tests is insufficient when business rules exist.