Trek_CN/server/tests/unit
jubnl 5eaf7492dc
fix(backups,files): auto-backups rejected by validator; trip file download broken after cookie migration
Fixes #773: isValidBackupFilename regex anchored to ^backup- rejected all
auto-backup-* filenames, causing 400 on download/restore/delete. Broadened
to ^(?:auto-)?backup-.

Fixes #774: three regressions in the trip Files tab —
- openFile import shadowed by a local function of the same name inside
  FileManager; PDF preview modal was calling the local with a URL string,
  corrupting state and crashing on the second click (mime_type read on
  undefined). Fixed by aliasing the import as openFileUrl.
- GET /:id/download used a bespoke authenticateDownload that checked only
  Bearer header and ?token= query param, ignoring the trek_session cookie.
  After the JWT-to-cookie migration the client sends cookies only, so every
  download silently 401-ed. Extended authenticateDownload to accept req and
  check cookie → Bearer → query token in priority order.
- files.download and files.openError translation keys were missing from all
  15 locale files; t() was returning the raw key as a truthy string,
  defeating the || 'Download' fallback.
2026-04-21 11:18:17 +02:00
..
mcp fix(mcp): add RFC 9728 PRM, RFC 8707 audience binding, and collab sub-feature gating 2026-04-20 07:34:38 +02:00
middleware security: close SEC-H4/H6 gaps from second-pass review 2026-04-20 21:35:30 +02:00
services fix(backups,files): auto-backups rejected by validator; trip file download broken after cookie migration 2026-04-21 11:18:17 +02:00
systemNotices feat(system-notices): replace expiresAt with [minVersion, maxVersion) version gate 2026-04-17 20:03:23 +02:00
utils test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
scheduler.test.ts Add comprehensive backend test suite (#339) 2026-04-03 13:17:53 +02:00