Trek_CN/server/tests/integration
Julien G. de6c0fb781
fix: prevent Invalid URL crash when APP_URL lacks a protocol (#972)
* fix: prevent Invalid URL crash when APP_URL lacks a protocol (issue #970)

- Add getMcpSafeUrl() to notifications.ts: wraps getAppUrl() and
  guarantees a result that satisfies the MCP SDK's checkIssuerUrl
  requirement (https:// or http://localhost). Non-HTTPS, non-localhost
  URLs fall back to http://localhost:{PORT} instead of propagating an
  "Issuer URL must be HTTPS" error.
- Switch app.ts, mcp/index.ts, mcp/oauthProvider.ts, and oauthService.ts
  to import getMcpSafeUrl instead of getAppUrl for all MCP resource URL
  construction, so a misconfigured APP_URL never crashes the metadata
  router initialisation.
- Restrict the SDK metadata router middleware to /.well-known/* paths
  only. Previously it was invoked on every request; in production the
  lazy getMetaRouter() init ran on GET / and threw "Invalid URL" when
  APP_URL had no scheme, returning 500 for every page load.
- Log a startup warning when APP_URL is set but not usable, and include
  the resolved App URL in the startup banner so operators can confirm
  the correct value at a glance.
- Update oauth.test.ts mock to target notifications.getMcpSafeUrl.

* fix: show getAppUrl in banner and add two separate APP_URL startup checks

- Banner now displays getAppUrl() (the resolved app URL) rather than
  getMcpSafeUrl() so operators see the actual configured value
- Two independent startup warnings after the banner when APP_URL is set:
  1. whether APP_URL is a valid URL (parseable by new URL())
  2. whether APP_URL is MCP-safe (https:// or http://localhost)
- Fix getMcpSafeUrl() fallback port to use Number(PORT) || 3001,
  consistent with how index.ts parses PORT

* fix: update oidc.ts to import getAppUrl from notifications
2026-05-07 13:49:39 +02:00
..
admin.test.ts Bug fixes - May 2nd 2026 (#941) 2026-05-03 17:39:45 +02:00
assignments.test.ts test: apply suite review improvements (01–11) 2026-04-06 20:08:13 +02:00
atlas.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
auth.test.ts Bug fixes - May 2nd 2026 (#941) 2026-05-03 17:39:45 +02:00
backup.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
budget.test.ts Bug fixes - April 30th 2026 (#936) 2026-05-01 01:43:19 +02:00
categories.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
collab.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
dayNotes.test.ts Add comprehensive backend test suite (#339) 2026-04-03 13:17:53 +02:00
days.test.ts Bug fixes - April 30th 2026 (#936) 2026-05-01 01:43:19 +02:00
files.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
immich.test.ts fix(tests): update test helpers and assertions for migration-98 photo schema 2026-04-14 13:54:48 +02:00
journey.test.ts fix: update backend tests and service bugs for gallery 1-to-N schema 2026-04-22 16:05:18 +02:00
maps.test.ts fix(search-autocomplete): address PR #542 review issues 2026-04-15 04:16:56 +02:00
mcp.test.ts fix(test): bumb default limit to reflect implementation 2026-04-11 02:32:17 +02:00
memories-immich.test.ts fix(journey): paginate Immich picker and group photos by date 2026-04-16 15:32:56 +02:00
memories-synology.test.ts fix(synology): correct multi-album passphrase assignment and stale trek_photos 2026-04-17 19:48:12 +02:00
memories-unified.test.ts fix(tests): update test helpers and assertions for migration-98 photo schema 2026-04-14 13:54:48 +02:00
misc.test.ts fix: skip FORCE_HTTPS redirect for /api/health endpoint 2026-04-19 14:10:41 +02:00
notifications.test.ts feat(notifications): add ntfy as a first-class notification channel 2026-04-15 13:59:25 +02:00
oauth.test.ts fix: prevent Invalid URL crash when APP_URL lacks a protocol (#972) 2026-05-07 13:49:39 +02:00
oidc.test.ts security: close SEC-H4/H6 gaps from second-pass review 2026-04-20 21:35:30 +02:00
packing.test.ts test: apply suite review improvements (01–11) 2026-04-06 20:08:13 +02:00
places.test.ts feat(import): selective GPX/KML element import and performance improvements 2026-04-18 01:28:37 +02:00
profile.test.ts test: apply suite review improvements (01–11) 2026-04-06 20:08:13 +02:00
reservations.test.ts Bug fixes - April 30th 2026 (#936) 2026-05-01 01:43:19 +02:00
security.test.ts test: apply suite review improvements (01–11) 2026-04-06 20:08:13 +02:00
settings.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
share.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
systemNotices.test.ts Bug fixes - May 2nd 2026 (#941) 2026-05-03 17:39:45 +02:00
tags.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
todo.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
trips.test.ts Bug fixes - May 2nd 2026 (#941) 2026-05-03 17:39:45 +02:00
vacay.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00
weather.test.ts test: expand test suite to 87.3% backend coverage 2026-04-06 20:08:30 +02:00