Testing
Unit tests
just test
Tests cover:
- Data source seam —
MockDataSourceandKanidmDataSourcebehaviour - Auth flows — login with password, password+TOTP, backup code
- Composite operations — group and OAuth2 application creation
- Mappers — Kanidm API response parsing and domain model mapping
E2E tests
# Full suite against a real Kanidm
just e2e-kanidm
# WebAuthn / passkey test
just e2e-webauthn
# Recovery email test
just e2e-recovery-mail
The main E2E suite (scripts/e2e-real-kanidm.mjs) uses Playwright with Chromium
against a real Kanidm instance. It verifies 22 behaviours:
- Expired session redirect
- Admin login
- Group creation (parent and child)
- Person creation with group membership
- Group membership toggling
- Nested relationship resolution
- OAuth2 application creation
- Application image upload and reset
- Domain image upload and reset
- Credential setup (password, TOTP, backup codes) via reset token
- Native OAuth2 discovery, consent, and access denial
- Non-admin portal login with backup code
- Non-admin route guards (admin pages redirect to portal)
- Non-admin mutation denial (direct API calls are rejected)
- Profile read-only enforcement
- RADIUS self-service
- SSH public key management
- Reauth flow
- Session revocation
- Unix credential self-service
- Logout
- Fixture cleanup
Each run creates unique test fixtures and cleans them up on completion, even when tests fail.
Requirements
KANIDM_PASSWORDin.env.local- Running Kanidm instance (via
./scripts/dev-kanidm-bootstrap.sh) - Caddy proxy (via
docker compose -f deploy/local/docker-compose.yml up -d dashboard-proxy)
Production artifact audit
just audit
Verifies the production build output: checks that all expected files exist, the JavaScript bundle is non-empty, SPA fallback works, and the config file is valid.