Kredal Docs
Tutorials

Run the Tests

Run unit tests, typecheck, lint, and a production build for kredal-app.

Kredal's business logic — the scoring engine and report templates — is covered by fast, pure-function unit tests that need no database.

Unit tests (Vitest)

cd kredal-app
npm test

This runs vitest run. It covers:

  • Scoring engine (src/lib/scoring/engine.test.ts): category scores, the risk-band thresholds, and specific rules (missing trade license, missing UBO declaration, missing source-of-funds, high-risk activity).
  • Report templates (src/lib/reports/templates.test.ts): the mandatory disclaimer is present, and the company name and score render.

Typecheck

npx tsc --noEmit

Lint

npm run lint

Production build

The build also runs a full TypeScript check across the whole app:

npm run build

When to run what

ChangeRun
Scoring or report logicnpm test then npm run build
Any component or pagenpm run build (catches route + RSC errors)
Docs onlySee docs CInpm test not required

If you change the scoring engine, also regenerate its reference doc — see Add a scoring rule.

On this page