Trek_CN/server/tests/unit/services
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
..
adminService.test.ts fix(tests): update tests for granular auth toggles 2026-04-11 20:33:51 +02:00
apiKeyCrypto.test.ts Add comprehensive backend test suite (#339) 2026-04-03 13:17:53 +02:00
atlasService.test.ts fix(tests): update test helpers and assertions for migration-98 photo schema 2026-04-14 13:54:48 +02:00
auditLog.test.ts Add comprehensive backend test suite (#339) 2026-04-03 13:17:53 +02:00
authService.test.ts Add comprehensive backend test suite (#339) 2026-04-03 13:17:53 +02:00
authServiceDb.test.ts feat(auth): split OIDC_ONLY into granular auth toggles 2026-04-11 20:21:36 +02:00
backupService.test.ts fix(backups,files): auto-backups rejected by validator; trip file download broken after cookie migration 2026-04-21 11:18:17 +02:00
budgetService.test.ts test: apply suite review improvements (01–11) 2026-04-06 20:08:13 +02:00
categoryService.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
collabService.test.ts test: add comprehensive coverage for OAuth scopes, MCP, and core services 2026-04-11 14:08:09 +02:00
cookie.test.ts test: update cookie test to match sameSite lax change 2026-04-03 14:42:48 +02:00
dayService.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
ephemeralTokens.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
inAppNotificationActions.test.ts test: apply suite review improvements (01–11) 2026-04-06 20:08:13 +02:00
inAppNotificationPrefs.test.ts feat(notifications): add unified multi-channel notification system 2026-04-05 01:22:18 +02:00
journeyService.test.ts fix journey bugs reported by roel-de-vries (#722-#736) 2026-04-18 19:11:16 +02:00
journeyShareService.test.ts fix journey bugs reported by roel-de-vries (#722-#736) 2026-04-18 19:11:16 +02:00
kmlImportUtils.test.ts feat(places): unified file import modal with drag-and-drop and deduplication 2026-04-15 06:07:26 +02:00
kmzUnpack.test.ts fix(kml-import): address PR #488 review issues 2026-04-15 05:16:47 +02:00
mapsService.test.ts test(maps): update getPlacePhoto stubs to use text() instead of json() 2026-04-21 00:16:54 +02:00
memoriesHelpers.test.ts test: add comprehensive coverage for OAuth scopes, MCP, and core services 2026-04-11 14:08:09 +02:00
memoriesUnified.test.ts test: add comprehensive coverage for OAuth scopes, MCP, and core services 2026-04-11 14:08:09 +02:00
mfaCrypto.test.ts Add comprehensive backend test suite (#339) 2026-04-03 13:17:53 +02:00
migration.test.ts feat(notifications): add unified multi-channel notification system 2026-04-05 01:22:18 +02:00
notificationPreferencesService.test.ts test(notifications): bump event_types count to 9 after adding todo_due 2026-04-20 17:38:25 +02:00
notifications.test.ts feat(notifications): add ntfy as a first-class notification channel 2026-04-15 13:59:25 +02:00
notificationService.test.ts feat(notifications): add ntfy as a first-class notification channel 2026-04-15 13:59:25 +02:00
oauthService.test.ts fix(mcp): add RFC 9728 PRM, RFC 8707 audience binding, and collab sub-feature gating 2026-04-20 07:34:38 +02:00
oidcService.test.ts test: add comprehensive coverage for OAuth scopes, MCP, and core services 2026-04-11 14:08:09 +02:00
packingService.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
passwordPolicy.test.ts Add comprehensive backend test suite (#339) 2026-04-03 13:17:53 +02:00
permissions.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
placeService.test.ts feat(import): selective GPX/KML element import and performance improvements 2026-04-18 01:28:37 +02:00
queryHelpers.test.ts test: apply suite review improvements (01–11) 2026-04-06 20:08:13 +02:00
settingsService.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
tagService.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
todoService.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
tripService.test.ts fix(trips): preserve day content when trip date range changes 2026-04-15 01:28:53 +02:00
vacayService.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
versionNotification.test.ts fix: restore broken tests after prerelease workflow refactor 2026-04-12 17:19:24 +02:00
weatherService.test.ts fix tests for sidebar/settings refactor + weather archive fallback 2026-04-18 11:45:19 +02:00