Testing contributions
Testing a Customer Portal contribution means checking its layer boundary as well as its happy path. A feature that works only for one role, one organization, or while tightly coupled to the host is not complete.
Project checks
Run the source-level feature tests first, then the full application checks:
pnpm test:features
pnpm validate:feature-locales
pnpm lint
pnpm typecheck
pnpm build
test:features runs the tests owned by layers. validate:feature-locales focuses on the current business features and verifies their locale and contract conventions.
Authorization matrix
For each protected server operation, cover at least:
| Context | Expected result |
|---|---|
| No session | Rejected |
| Member without the action | Rejected |
| Owner or organization administrator with the action | Allowed |
| Correct user, wrong active organization | Rejected or empty, never leaked |
| System administrator | Matches the documented platform bypass |
Client-side visibility is a separate UI test; it never replaces handler-level authorization.
Data and migrations
When a contribution changes a schema:
- Generate and review the root migration.
- Apply it to an empty database.
- Apply it to representative pre-change data.
- Verify every feature-owned table and enum uses the feature schema.
- Exercise deletion behavior and cross-schema references.
- Confirm tenant-owned queries always include the active organization.
Feature contract
Test that registered IDs are stable and unique, audiences match the intended roles, module route prefixes activate the right menu, widgets occupy the intended area and size, and every policy action is mapped deliberately.
Keep English and Dutch key structures identical. Render important states in both locales, including empty, loading, validation, error, and destructive-confirmation states.
Portability
Build the assembled portal with the layer enabled. Also exclude the layer from a copy of the application and verify that the host still typechecks and builds. Feature removal must not leave imports, navigation entries, widget registrations, locale dependencies, or server references behind.
Use service requests as the compact testing reference and review tenancy and security before changing protected data access.