test: minimal vitest harness for backend and frontend
From the PR description
Summary
Upstream currently has no test runner at all - backend/package.json carries only dev/build/start scripts and frontend/ has none either. This adds the smallest possible vitest harness to both packages (a dev-dependency, a test script, and one unit test each of existing pure functions) so that future changes can carry regression tests.
Changes
backend/package.json: add"test": "vitest run"script andvitest@^4.1.9devDependencybackend/tsconfig.json: excludesrc/**/*.test.tsandsrc/**/__tests__/**so tests never reachdist/(tsc build output unchanged)backend/src/lib/__tests__/downloadTokens.test.ts: unit tests forsignDownload/verifyDownload/buildDownloadUrl(round-trip, tampered payload/signature, malformed tokens, wrong secret, URL embedding)frontend/package.json: add"test": "vitest run"script andvitest@^4.1.9devDependencyfrontend/src/app/lib/utils.test.ts: unit tests forcn,diceCoefficient,isFuzzyMatchbackend/package-lock.json,frontend/package-lock.json: regenerated vianpm install --save-dev vitest@4.1.9(never hand-edited)
No vitest config files are needed - vitest picks up *.test.ts zero-config. No jsdom or testing-library; both suites test pure functions only.
Why
A safety net for large sync bursts: with even a minimal harness in place, any future PR can land with tests instead of establishing infrastructure first. Dev-dependencies only - zero runtime cost, zero hosting cost, no CI workflow changes, no eslint changes.
Testing
cd backend && npm install && npm test- 1 file, 12 tests passed (vitest 4.1.9)cd backend && npm run build- tsc passes; verifieddist/contains no test filescd frontend && npm install && npm test- 1 file, 8 tests passed (vitest 4.1.9)- Frontend
next buildnot run (only test files and dev-dependencies changed)
Provenance
All changes are mechanical ports of code in amal66/mike@origin/main (commit b3166dd); exceptions: none.
"test": "vitest run"script: verbatim fromapps/api/package.jsonandapps/web/package.jsonvitest@^4.1.9: range declared inapps/web/package.json; 4.1.9 is the exact version resolved in the fork's lockfile (apps/api declares^4.1.7, which also resolves to 4.1.9 there)- tsconfig
excludeentries: verbatim fromapps/api/tsconfig.json frontend/src/app/lib/utils.test.ts: byte-identical copy ofapps/web/src/app/lib/utils.test.tsbackend/src/lib/__tests__/downloadTokens.test.ts: strict subset ofapps/api/src/lib/__tests__/downloadTokens.test.ts(zero added lines); the fork-onlycore/downloadTokensimport and its "token expiry" suite are dropped because that module does not exist upstream- lockfile diffs: npm-generated; residual churn is npm reconciling the pre-existing lockfiles during install
🤖 Generated with Claude Code
Our analysis
Add a minimal Vitest test harness — read the full analysis →
Think the analysis missed something the PR description covers?
Capture this PR into my fork
Download a Markdown prompt that tells Claude how to port every
commit in this PR into your working tree. Run it via
claude -p < capture-pull-222.md from
inside the repo you want the changes in.