Test from the module to the end-to-end journey
See how the foundation combines unit, integration, API, and end-to-end tests to protect business rules and security.
In the appRepository · CIUpdated September 19, 2026
See how the foundation combines unit, integration, API, and end-to-end tests to protect business rules and security.
The foundation provides several testing levels because no single level is enough. A business rule can be correct in isolation and fail once connected to PostgreSQL. An API can respond correctly yet remain unusable in the browser. The test plan connects these levels.
1. Fast unit tests
They cover pure functions, Zod schemas, calculations, permissions, data transformations, error mapping, and isolated components. They provide fast feedback during development and let you name each invariant precisely.
Examples: a capability matches a pattern, an invalid date is rejected, a pasted cell is converted to the correct type, and a tampered encrypted key cannot be decrypted.
2. Integration tests
They exercise real adapters: PostgreSQL repositories, transactions, migrations, Redis, RabbitMQ, object storage, or file parsers. They verify what mocks cannot prove, such as a SQL constraint, a transaction rollback, or messaging channel recovery.
Costly external dependencies remain replaced by controlled test doubles. The goal is to test the technical boundary, not call a third-party service on every commit.
3. API tests
Controllers are exercised over HTTP with their guards, validation, and serialization. For a protected route, the useful minimum goes beyond the happy path:
400for invalid input;401without a valid identity;403without the required capability;4. Frontend tests
Kit components have their own tests for keyboard interaction, selection, templates, errors, and asynchronous states. Pages then add application rules: forms, routing, loading, and component composition.
A useful frontend test verifies observable behavior. It avoids reproducing in the assertion the internal implementation it is meant to protect.
5. End-to-end journeys
End-to-end scenarios combine the layers across a small number of critical journeys:
For an import, the scenario can upload a file, correct a row, validate the batch, then check the result in the business list. For a mapping application, it can filter a category, open a marker, and confirm that the corresponding record respects permissions.
CI assembles the evidence
The pipeline combines linting, type checking, targeted tests, tests with infrastructure, OpenAPI contracts, and a smoke test of the generated template. The suites that are actually mandatory depend on the delivered repository: the project documentation must list those that block a merge.
The application's test plan names the critical journeys, permission matrix, and boundary errors covered by CI.