Baseleg Docs

Testing strategy

Baseleg uses a layered testing approach designed for a Cloudflare runtime and a modular monolith.

Unit + application tests (now)

  • Use Vitest for:
    • Domain rule tests (invariants, policies).
    • Application use case tests (happy paths + key failure paths).
  • Domain tests should not depend on Astro or D1 bindings.

Runtime-aware tests (later)

For D1-bound flows and Workers bindings, add runtime-aware integration tests later:

  • Use Vitest with Cloudflare runtime/bindings tooling (Workers/D1 integration) when wiring is introduced.
  • Focus on: migrations, repository implementations, and critical cross-module behavior.

End-to-end journeys (later)

Use Playwright for critical user journeys (e.g. booking creation, conflict detection, grounded aircraft protection).

Regression requirement

Every bug fix requires a regression test:

  • Prefer adding a failing test first (where feasible).
  • Fix the bug.
  • Ensure the new test covers the regression scenario.