Testing and Quality
Current Coverage
The repository includes tests for the critical implementation surfaces:
apps/api/src/middleware/auth.middleware.test.tsapps/api/src/middleware/rbac.middleware.test.tsapps/api/src/middleware/tenant.isolation.test.tsapps/api/src/services/ingestion.idempotency.test.tsapps/api/src/routes/redemption-concurrency.test.tsapps/api/src/routes/admin-workflows.test.tsapps/api/src/services/merchant-analytics.test.tsapps/api/src/services/clover-poll.test.tsapps/api/src/services/clover-adapter.test.tsapps/api/src/lib/brand-identity.test.tspackages/reward-engine/src/promotions.test.tspackages/reward-engine/src/evaluate.test.tspackages/rbac/src/permissions.test.tsapps/api/src/lib/campaign-render.test.tsapps/api/src/lib/clover.test.tsapps/api/src/lib/resend-from.test.tsapps/api/src/services/campaign-audience.test.tsapps/api/src/lib/webhook-signature.test.ts
These tests cover auth and RBAC, tenant isolation, ingestion idempotency, redemption concurrency, admin workflows, merchant analytics, Clover polling and normalization, brand identity, promotion math, reward calculation, campaign rendering, and webhook signatures.
Quality Gates
Workspace scripts enforce the main quality checks:
pnpm lintpnpm typecheckpnpm testpnpm build
TypeScript is configured for strict mode with noUncheckedIndexedAccess and exactOptionalPropertyTypes.
Active Deployment Workflows
API deploy workflow
.github/workflows/deploy-api.yml:
- Loads environment variables from Bitwarden Secrets Manager.
- Syncs them to Render.
- Triggers a Render deploy.
Web deploy workflow
.github/workflows/deploy.yml:
- Loads web env vars from Bitwarden Secrets Manager.
- Builds
apps/web. - Publishes the build to Cloudflare Pages.
Lint and Type Rules
The workspace ESLint config is intentionally strict:
- no
any - no floating promises
- explicit module boundary types
- unknown in catch callbacks
These rules are meant to keep the API and shared packages predictable.
Current Gaps
Remaining gaps include:
- End-to-end merchant onboarding coverage.
- Square polling watermark progression tests.
- Email send-path tests beyond rendering and sender normalization.
Practical Release Checklist
Before a release, the repo should have:
pnpm lintpassingpnpm typecheckpassingpnpm testpassing- a successful workspace build
- the API deploy workflow green
- the web deploy workflow green
Written byDhruv Doshi