mike/backend
QA Runner c139acc3c6 test: unit tests for access, storage, userApiKeys, chat doc resolution
Ported from the amal66 fork (see index Open-Legal-Products/mike#205)
onto current main, adapted to this repo's backend/ layout
(apps/api/src/lib -> backend/src/lib), plus a v8 coverage ratchet.

Suites ported (51 new tests, verified locally):
- access.test.ts (7): owner/shared/private project access, doc access,
  review sharing, document-ID filtering. Dropped the fork's "org RBAC"
  describe block (7 cases) — org_id/org_members multi-tenancy and the
  role/canManage fields do not exist in this repo's access.ts.
- storage.test.ts (25): filename normalization/sanitization, RFC 5987
  encoding, Content-Disposition, storage key helpers. Dropped the fork's
  vi.mock of lib/env — this repo has no env module; storage reads
  process.env directly and the tested helpers are pure.
- userApiKeys.test.ts (10): normalizeApiKeyProvider + hasEnvApiKey.
  Added a beforeEach env clear so shell-exported API keys can't leak
  into assertions.
- chatTypes.test.ts (9): resolveDoc/resolveDocLabel, which live in
  lib/chat/types.ts here (the fork's lib/chatTools.ts equivalent).
  Dropped generateSpotlightNonce cases (2) — no such export here.

Suites dropped entirely (subject not present in this repo):
- upload.test.ts — tested hasMagicBytes; this repo's lib/upload.ts is
  only the multer middleware and exports no magic-byte checker.
- userSettings.test.ts — tested resolveTabularModel (fork-only keyed-
  provider fallback); this repo resolves tabular_model via
  resolveModel with a static default.

Coverage ratchet: vitest.config.mts adds v8 coverage over src/lib/**
with floors measured against this tree (2.58% stmts, 2.00% branches,
4.61% funcs, 2.58% lines -> floors 2/2/4/2). Full suite: 5 files,
63 tests passing (incl. the pre-existing 12 in downloadTokens.test.ts);
npm run test:coverage and npm run build both pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 10:49:27 -07:00
..
migrations feat: add library and refresh shared table UI 2026-07-16 20:07:12 +08:00
src test: unit tests for access, storage, userApiKeys, chat doc resolution 2026-07-20 10:49:27 -07:00
.env.example Add courtlistener intergration, liquid glass redesign, UI improvements, version control, various fixes 2026-06-06 15:48:47 +08:00
.gitignore Refactor ProjectPageParts and ProjectPageHeader components for improved loading states and skeleton UI. Update Modal and PageHeader components to support loading states. Enhance RenameableTitle for better caret positioning. Adjust DisplayWorkflowModal to utilize the new Modal component structure. Update WorkflowList to include loading indicators and improve sticky header behavior. 2026-06-11 21:50:58 +08:00
bun.lock feat: workflow, UI and document support updates 2026-07-08 18:27:28 +08:00
nixpacks.toml Sync deployment and project page fixes 2026-05-13 02:32:26 +08:00
package-lock.json test: unit tests for access, storage, userApiKeys, chat doc resolution 2026-07-20 10:49:27 -07:00
package.json test: unit tests for access, storage, userApiKeys, chat doc resolution 2026-07-20 10:49:27 -07:00
schema.sql feat: add library and refresh shared table UI 2026-07-16 20:07:12 +08:00
tsconfig.json test: minimal vitest harness for backend and frontend 2026-07-20 10:42:28 -07:00
vitest.config.mts test: unit tests for access, storage, userApiKeys, chat doc resolution 2026-07-20 10:49:27 -07:00