The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
test(server): src/config takes fixed test values from the setup file, so suites stop mocking it
Maurice00cbc5aae3cb
diff --git a/server/src/nest/common/api-docs.kill-switch.ts b/server/src/nest/common/api-docs.kill-switch.tsindex edaa14fc7..7348d3c88 100644--- a/server/src/nest/common/api-docs.kill-switch.ts+++ b/server/src/nest/common/api-docs.kill-switch.ts@@ -1,7 +1,7 @@/**- * API-docs kill switch (#1412). Deliberately NOT in src/config.ts: tests mock- * that module with partial exports, and reading the env at call time keeps the- * flag testable per-request (same pattern as plugins/kill-switch.ts).+ * API-docs kill switch (#1412). Deliberately NOT in src/config.ts: that module+ * is frozen at import (and replaced wholesale under test), and reading the env+ * at call time keeps the flag testable per-request (same pattern as plugins/kill-switch.ts).** Off by default — the generated spec enumerates every route including the* admin surface, so exposing it is an explicit self-hoster decision.diff --git a/server/src/nest/plugins/kill-switch.ts b/server/src/nest/plugins/kill-switch.tsindex 5d767431a..c452f4aba 100644--- a/server/src/nest/plugins/kill-switch.ts+++ b/server/src/nest/plugins/kill-switch.ts@@ -4,9 +4,8 @@* still have to be activated one by one, so no third-party code runs until an* admin turns a specific plugin on. Set TREK_PLUGINS_ENABLED=false to switch the* whole system off (installed plugins stay on disk, deactivated). Lives in its- * own module (not config.ts) so the many tests that mock config with a partial- * export set don't have to know about it: the plugin runtime reads the env- * directly here. Read at call time so tests and runtime env changes take effect+ * own module (not config.ts), whose values are frozen at import and replaced+ * wholesale under test: the plugin runtime reads the env directly here. Read at call time so tests and runtime env changes take effect* immediately.*/import { readEnv } from '../../app-config';diff --git a/server/tests/e2e/storage-admin.e2e.test.ts b/server/tests/e2e/storage-admin.e2e.test.tsindex 1f6b9efdd..aaa453357 100644--- a/server/tests/e2e/storage-admin.e2e.test.ts+++ b/server/tests/e2e/storage-admin.e2e.test.ts@@ -29,13 +29,10 @@ vi.mock('../../src/db/database', async () => {// The audit domain is DI-native: writeAudit runs for real against the temp db's// audit_log table; only the file logger is silenced.vi.mock('../../src/nest/audit/audit-log.logger', () => ({ LOG_LEVEL: 'error', logInfo: vi.fn(), logDebug: vi.fn(), logError: vi.fn(), logWarn: vi.fn() }));-// apiKeyCrypto imports ENCRYPTION_KEY from here for the cipher; the raw-// process.env var is managed separately in beforeAll/afterAll for the-// no-explicit-key case (STORE2E-007). JWT_SECRET must also be-// supplied — jwt-verify.ts (JwtAuthGuard) and the harness's signSession both-// import it from this same module, so mocking the module wholesale requires-// keeping both consistent.-vi.mock('../../src/config', () => ({ ENCRYPTION_KEY: 'e2e-storage-key', JWT_SECRET: 'e2e-storage-jwt-secret' }));+// apiKeyCrypto reads ENCRYPTION_KEY for the cipher from src/config, which the+// global test setup fixes (tests/helpers/test-config.ts); the raw process.env+// var is managed separately in beforeAll/afterAll for the no-explicit-key case+// (STORE2E-007).import { TrekExceptionFilter } from '../../src/nest/common/trek-exception.filter';import { ZodValidationPipe } from '../../src/nest/common/zod-validation.pipe';diff --git a/server/tests/helpers/auth.ts b/server/tests/helpers/auth.tsindex 9ba5db467..c57d92a1b 100644--- a/server/tests/helpers/auth.ts+++ b/server/tests/helpers/auth.ts@@ -6,7 +6,7 @@*/import jwt from 'jsonwebtoken';-import { TEST_CONFIG } from './test-db';+import { TEST_CONFIG } from './test-config';/** Signs a JWT for the given user ID using the test secret. */export function generateToken(userId: number, extraClaims: Record<string, unknown> = {}): string {diff --git a/server/tests/helpers/test-config.ts b/server/tests/helpers/test-config.tsnew file mode 100644index 000000000..44353917c--- /dev/null+++ b/server/tests/helpers/test-config.ts@@ -0,0 +1,63 @@+/**+ * The values `src/config` holds under test.+ *+ * tests/setup.ts mocks `src/config` with this object for every test file, so a+ * suite never reads or writes the key files under data/ and every suite signs+ * tokens with the same secret the code under test verifies them with. A suite+ * does not declare its own `vi.mock` of the config module (lint:test-mocks+ * counts them); one that needs a different value calls `overrideTestConfig`,+ * and the setup file puts the defaults back after every test.+ *+ * This file must not import application code: the setup file loads it before+ * any module under test, and an app import here would resolve against the+ * environment before the setup file has written it.+ */+import type * as RealConfig from '../../src/config';++type ConfigModule = typeof RealConfig;+type ConfigValues = Omit<ConfigModule, 'updateJwtSecret'>;++const DEFAULTS: ConfigValues = {+ JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',+ ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',+ DEFAULT_LANGUAGE: 'en',+ SESSION_DURATION: '24h',+ SESSION_DURATION_MS: 86400000,+ SESSION_DURATION_SECONDS: 86400,+ SESSION_DURATION_REMEMBER: '30d',+ SESSION_DURATION_REMEMBER_MS: 2592000000,+ SESSION_DURATION_REMEMBER_SECONDS: 2592000,+};++/**+ * The mocked module itself. Code under test reads its exports at call time,+ * so a change made by `overrideTestConfig` is seen by the next read.+ * `updateJwtSecret` stays inert, as it was in every per-file mock before: a+ * rotation inside one case must not change the secret the next case signs with.+ */+export const TEST_CONFIG: ConfigModule = {+ ...DEFAULTS,+ updateJwtSecret: () => {},+};++/**+ * Set config values for the current test. Returns a function that puts the+ * previous values back; the setup file also restores the defaults after every+ * test, so calling it is only needed to undo an override inside one case.+ */+export function overrideTestConfig(values: Partial<ConfigValues>): () => void {+ const previous: Partial<ConfigValues> = {};+ const target = TEST_CONFIG as unknown as Record<string, unknown>;+ for (const key of Object.keys(values) as (keyof ConfigValues)[]) {+ (previous as Record<string, unknown>)[key] = target[key];+ target[key] = values[key];+ }+ return () => {+ for (const key of Object.keys(previous)) target[key] = (previous as Record<string, unknown>)[key];+ };+}++/** Put every value back to its default. Called by tests/setup.ts after each test. */+export function resetTestConfig(): void {+ Object.assign(TEST_CONFIG, DEFAULTS);+}diff --git a/server/tests/helpers/test-db.ts b/server/tests/helpers/test-db.tsindex 50739b36c..296cfe48f 100644--- a/server/tests/helpers/test-db.ts+++ b/server/tests/helpers/test-db.ts@@ -10,7 +10,6 @@* const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');* return buildDbMock(createSnapshotTestDb());* });- * vi.mock('../../src/config', () => TEST_CONFIG);** import { db as testDb } from '../../src/db/database';* import { resetTestDb, resetRateLimits } from '../helpers/test-db';@@ -188,15 +187,3 @@ export function resetRateLimits(app: INestApplication): Promise<void> {return ctrl.rl.reset();}-/** Fixed config mock — use with vi.mock('../../src/config', () => TEST_CONFIG) */-export const TEST_CONFIG = {- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- SESSION_DURATION_REMEMBER: '30d',- SESSION_DURATION_REMEMBER_MS: 2592000000,- SESSION_DURATION_REMEMBER_SECONDS: 2592000,-};diff --git a/server/tests/integration/admin.test.ts b/server/tests/integration/admin.test.tsindex 20e90bb8f..1ec52c692 100644--- a/server/tests/integration/admin.test.ts+++ b/server/tests/integration/admin.test.ts@@ -11,15 +11,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/airtrail-sync-request-context.test.ts b/server/tests/integration/airtrail-sync-request-context.test.tsindex 455f2f0bd..5f059bf91 100644--- a/server/tests/integration/airtrail-sync-request-context.test.ts+++ b/server/tests/integration/airtrail-sync-request-context.test.ts@@ -30,15 +30,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn(), getOnlineUserIds: vi.fn(() => []) }));import { MikroORM } from '@mikro-orm/core';diff --git a/server/tests/integration/api-docs.test.ts b/server/tests/integration/api-docs.test.tsindex 8de133939..f3b003878 100644--- a/server/tests/integration/api-docs.test.ts+++ b/server/tests/integration/api-docs.test.ts@@ -12,15 +12,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/app-config.test.ts b/server/tests/integration/app-config.test.tsindex 6df241350..6b1d771a9 100644--- a/server/tests/integration/app-config.test.ts+++ b/server/tests/integration/app-config.test.ts@@ -11,15 +11,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/assignments.test.ts b/server/tests/integration/assignments.test.tsindex 0c3ca28e2..c68da1530 100644--- a/server/tests/integration/assignments.test.ts+++ b/server/tests/integration/assignments.test.ts@@ -11,15 +11,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/async-closure-truthiness-guards.test.ts b/server/tests/integration/async-closure-truthiness-guards.test.tsindex a05285ca9..81c588e81 100644--- a/server/tests/integration/async-closure-truthiness-guards.test.ts+++ b/server/tests/integration/async-closure-truthiness-guards.test.ts@@ -87,15 +87,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn(), getOnlineUserIds: vi.fn(() => []) }));import request from 'supertest';diff --git a/server/tests/integration/atlas-geocode-request-context.test.ts b/server/tests/integration/atlas-geocode-request-context.test.tsindex 549c31dfe..571af6650 100644--- a/server/tests/integration/atlas-geocode-request-context.test.ts+++ b/server/tests/integration/atlas-geocode-request-context.test.ts@@ -28,12 +28,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h', SESSION_DURATION_MS: 86400000, SESSION_DURATION_SECONDS: 86400, DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));vi.mock('../../src/nest/atlas/atlas-geo', async (orig) => {const actual = await orig<typeof import('../../src/nest/atlas/atlas-geo')>();diff --git a/server/tests/integration/atlas.test.ts b/server/tests/integration/atlas.test.tsindex 56ca4c3d7..5907b5d03 100644--- a/server/tests/integration/atlas.test.ts+++ b/server/tests/integration/atlas.test.ts@@ -12,15 +12,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/auth.test.ts b/server/tests/integration/auth.test.tsindex 95ef6fea7..20f7e8e32 100644--- a/server/tests/integration/auth.test.ts+++ b/server/tests/integration/auth.test.ts@@ -17,15 +17,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/backup.test.ts b/server/tests/integration/backup.test.tsindex 5aa88187b..29fb5e4ba 100644--- a/server/tests/integration/backup.test.ts+++ b/server/tests/integration/backup.test.ts@@ -15,15 +15,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));// Mock filesystem-dependent service functions to avoid real disk I/O in testsdiff --git a/server/tests/integration/boot-sweeps-request-context.test.ts b/server/tests/integration/boot-sweeps-request-context.test.tsindex bc03280be..0b397b804 100644--- a/server/tests/integration/boot-sweeps-request-context.test.ts+++ b/server/tests/integration/boot-sweeps-request-context.test.ts@@ -63,15 +63,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn(), getOnlineUserIds: vi.fn(() => []) }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/bootstrap.test.ts b/server/tests/integration/bootstrap.test.tsindex 3849d347e..6f0e9488e 100644--- a/server/tests/integration/bootstrap.test.ts+++ b/server/tests/integration/bootstrap.test.ts@@ -14,15 +14,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));// BOOT-007 boots with NODE_ENV=production, which opens the cron gate — keep the// registrar inert so a bootstrap test never schedules real jobs or runs bootdiff --git a/server/tests/integration/budget.test.ts b/server/tests/integration/budget.test.tsindex fd997236b..4dd33b271 100644--- a/server/tests/integration/budget.test.ts+++ b/server/tests/integration/budget.test.ts@@ -11,15 +11,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/categories.test.ts b/server/tests/integration/categories.test.tsindex e952850bc..e49fe5753 100644--- a/server/tests/integration/categories.test.ts+++ b/server/tests/integration/categories.test.ts@@ -11,15 +11,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { MikroORM } from '@mikro-orm/core';diff --git a/server/tests/integration/collab.test.ts b/server/tests/integration/collab.test.tsindex 17dd86230..c8fee53ef 100644--- a/server/tests/integration/collab.test.ts+++ b/server/tests/integration/collab.test.ts@@ -16,15 +16,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/collections.test.ts b/server/tests/integration/collections.test.tsindex 433a1ef1e..50da3bee8 100644--- a/server/tests/integration/collections.test.ts+++ b/server/tests/integration/collections.test.ts@@ -17,15 +17,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn(), getOnlineUserIds: vi.fn(() => []) }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/dayNotes.test.ts b/server/tests/integration/dayNotes.test.tsindex d5372183d..a7ec7e38e 100644--- a/server/tests/integration/dayNotes.test.ts+++ b/server/tests/integration/dayNotes.test.ts@@ -11,15 +11,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/dayReorder.test.ts b/server/tests/integration/dayReorder.test.tsindex 898690fa0..3c7b95766 100644--- a/server/tests/integration/dayReorder.test.ts+++ b/server/tests/integration/dayReorder.test.ts@@ -10,12 +10,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- DEFAULT_LANGUAGE: 'en',-}));import { db as testDb } from '../../src/db/database';import { resetTestDb } from '../helpers/test-db';diff --git a/server/tests/integration/days.test.ts b/server/tests/integration/days.test.tsindex e951be44f..ddbc2cbaa 100644--- a/server/tests/integration/days.test.ts+++ b/server/tests/integration/days.test.ts@@ -15,15 +15,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/doc-sync-webhook-request-context.test.ts b/server/tests/integration/doc-sync-webhook-request-context.test.tsindex 333196dda..b6478f65d 100644--- a/server/tests/integration/doc-sync-webhook-request-context.test.ts+++ b/server/tests/integration/doc-sync-webhook-request-context.test.ts@@ -44,15 +44,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn(), getOnlineUserIds: vi.fn(() => []) }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/feeds-request-context.test.ts b/server/tests/integration/feeds-request-context.test.tsindex 5530e5a7b..4cfce22f9 100644--- a/server/tests/integration/feeds-request-context.test.ts+++ b/server/tests/integration/feeds-request-context.test.ts@@ -48,15 +48,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn(), getOnlineUserIds: vi.fn(() => []) }));import { randomUUID } from 'node:crypto';diff --git a/server/tests/integration/files.test.ts b/server/tests/integration/files.test.tsindex 143193f6e..875b4898a 100644--- a/server/tests/integration/files.test.ts+++ b/server/tests/integration/files.test.ts@@ -18,15 +18,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/help.test.ts b/server/tests/integration/help.test.tsindex 965961a12..bfb59c9eb 100644--- a/server/tests/integration/help.test.ts+++ b/server/tests/integration/help.test.ts@@ -14,15 +14,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/immich.test.ts b/server/tests/integration/immich.test.tsindex 60802d4a3..9e4761c1f 100644--- a/server/tests/integration/immich.test.ts+++ b/server/tests/integration/immich.test.ts@@ -14,15 +14,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));// Mock SSRF guard: block loopback and private IPs, allow external hostnames without DNS.diff --git a/server/tests/integration/journey-place-order.test.ts b/server/tests/integration/journey-place-order.test.tsindex 1fe24ea11..d0916dbc6 100644--- a/server/tests/integration/journey-place-order.test.ts+++ b/server/tests/integration/journey-place-order.test.ts@@ -25,15 +25,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({broadcast: vi.fn(),broadcastToUser: vi.fn(),diff --git a/server/tests/integration/journey.test.ts b/server/tests/integration/journey.test.tsindex b4727ee8a..9c5a7c3e4 100644--- a/server/tests/integration/journey.test.ts+++ b/server/tests/integration/journey.test.ts@@ -14,15 +14,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({broadcast: vi.fn(),broadcastToUser: vi.fn(),diff --git a/server/tests/integration/leg-mode-incoming.test.ts b/server/tests/integration/leg-mode-incoming.test.tsindex 2b3503270..582773b0d 100644--- a/server/tests/integration/leg-mode-incoming.test.ts+++ b/server/tests/integration/leg-mode-incoming.test.ts@@ -17,15 +17,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb2 } from '../../src/db/database';diff --git a/server/tests/integration/legacy-upgrade-v066.test.ts b/server/tests/integration/legacy-upgrade-v066.test.tsindex 185575d2c..a0b40cbcb 100644--- a/server/tests/integration/legacy-upgrade-v066.test.ts+++ b/server/tests/integration/legacy-upgrade-v066.test.ts@@ -16,15 +16,6 @@ vi.mock('../../src/db/database', async () => {const { openLegacyFixture } = await import('../helpers/legacy-fixture');return buildDbMock(openLegacyFixture('legacy-v066'));});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({broadcast: vi.fn(),broadcastToUser: vi.fn(),diff --git a/server/tests/integration/legacy-upgrade-v082.test.ts b/server/tests/integration/legacy-upgrade-v082.test.tsindex 24a2d8dcb..20bcc358a 100644--- a/server/tests/integration/legacy-upgrade-v082.test.ts+++ b/server/tests/integration/legacy-upgrade-v082.test.ts@@ -13,15 +13,6 @@ vi.mock('../../src/db/database', async () => {const { openLegacyFixture } = await import('../helpers/legacy-fixture');return buildDbMock(openLegacyFixture('legacy-v082'));});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({broadcast: vi.fn(),broadcastToUser: vi.fn(),diff --git a/server/tests/integration/legacy-upgrade-v205.test.ts b/server/tests/integration/legacy-upgrade-v205.test.tsindex 7b64023f7..59bef9a2b 100644--- a/server/tests/integration/legacy-upgrade-v205.test.ts+++ b/server/tests/integration/legacy-upgrade-v205.test.ts@@ -13,15 +13,6 @@ vi.mock('../../src/db/database', async () => {const { openLegacyFixture } = await import('../helpers/legacy-fixture');return buildDbMock(openLegacyFixture('legacy-v205'));});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({broadcast: vi.fn(),broadcastToUser: vi.fn(),diff --git a/server/tests/integration/legacy-upgrade-v242.test.ts b/server/tests/integration/legacy-upgrade-v242.test.tsindex 421bed3bc..36874ed86 100644--- a/server/tests/integration/legacy-upgrade-v242.test.ts+++ b/server/tests/integration/legacy-upgrade-v242.test.ts@@ -13,15 +13,6 @@ vi.mock('../../src/db/database', async () => {const { openLegacyFixture } = await import('../helpers/legacy-fixture');return buildDbMock(openLegacyFixture('legacy-v242'));});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({broadcast: vi.fn(),broadcastToUser: vi.fn(),diff --git a/server/tests/integration/legacy-upgrade-v244.test.ts b/server/tests/integration/legacy-upgrade-v244.test.tsindex ed60bd9cb..9ac886201 100644--- a/server/tests/integration/legacy-upgrade-v244.test.ts+++ b/server/tests/integration/legacy-upgrade-v244.test.ts@@ -19,15 +19,6 @@ vi.mock('../../src/db/database', async () => {const { openLegacyFixture } = await import('../helpers/legacy-fixture');return buildDbMock(openLegacyFixture('legacy-v244'));});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({broadcast: vi.fn(),broadcastToUser: vi.fn(),diff --git a/server/tests/integration/maps.test.ts b/server/tests/integration/maps.test.tsindex 9e349d076..eeb08b2a9 100644--- a/server/tests/integration/maps.test.ts+++ b/server/tests/integration/maps.test.ts@@ -14,15 +14,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/mcp.test.ts b/server/tests/integration/mcp.test.tsindex 49de77945..09b6334db 100644--- a/server/tests/integration/mcp.test.ts+++ b/server/tests/integration/mcp.test.ts@@ -14,15 +14,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/memories-immich.test.ts b/server/tests/integration/memories-immich.test.tsindex 18abd6255..343a79498 100644--- a/server/tests/integration/memories-immich.test.ts+++ b/server/tests/integration/memories-immich.test.ts@@ -41,15 +41,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));// ── SSRF guard mock — routes all Immich API calls to fake responses ───────────diff --git a/server/tests/integration/memories-synology.test.ts b/server/tests/integration/memories-synology.test.tsindex b71732f00..a9fa5a35c 100644--- a/server/tests/integration/memories-synology.test.ts+++ b/server/tests/integration/memories-synology.test.ts@@ -19,15 +19,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));// ── SSRF guard mock — routes all Synology API calls to fake responses ─────────diff --git a/server/tests/integration/memories-unified.test.ts b/server/tests/integration/memories-unified.test.tsindex 0ffe78751..9e662acba 100644--- a/server/tests/integration/memories-unified.test.ts+++ b/server/tests/integration/memories-unified.test.ts@@ -18,15 +18,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));vi.mock('../../src/utils/ssrfGuard', async () => {const actual = await vi.importActual<typeof import('../../src/utils/ssrfGuard')>('../../src/utils/ssrfGuard');diff --git a/server/tests/integration/misc.test.ts b/server/tests/integration/misc.test.tsindex 44ceefe3b..fdedb7c94 100644--- a/server/tests/integration/misc.test.ts+++ b/server/tests/integration/misc.test.ts@@ -11,15 +11,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';@@ -121,7 +112,6 @@ describe('Force HTTPS redirect', () => {});});-describe('Request body ceiling', () => {// The Express shell set '100kb' and stopped when the Nest instance took over// parsing, which left the limit implicit. This pins it, so it cannot driftdiff --git a/server/tests/integration/notifications.test.ts b/server/tests/integration/notifications.test.tsindex a846bef73..64c7ac5ba 100644--- a/server/tests/integration/notifications.test.ts+++ b/server/tests/integration/notifications.test.ts@@ -15,15 +15,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));// The two test-send endpoints must not reach a real SMTP server or URL. Since// the fold they are provider methods, so they are stubbed on the prototypediff --git a/server/tests/integration/oauth-authorize.test.ts b/server/tests/integration/oauth-authorize.test.tsindex 0639116a7..d1daa6719 100644--- a/server/tests/integration/oauth-authorize.test.ts+++ b/server/tests/integration/oauth-authorize.test.ts@@ -18,15 +18,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/app-config', async (importOriginal) => {const actual = await importOriginal<typeof import('../../src/app-config')>();diff --git a/server/tests/integration/oauth.test.ts b/server/tests/integration/oauth.test.tsindex 9db063ebd..7f4fb8f2e 100644--- a/server/tests/integration/oauth.test.ts+++ b/server/tests/integration/oauth.test.ts@@ -13,15 +13,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/app-config', async (importOriginal) => {const actual = await importOriginal<typeof import('../../src/app-config')>();diff --git a/server/tests/integration/oidc-local-provider.test.ts b/server/tests/integration/oidc-local-provider.test.tsindex 7c920db95..0779ad114 100644--- a/server/tests/integration/oidc-local-provider.test.ts+++ b/server/tests/integration/oidc-local-provider.test.ts@@ -27,18 +27,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- SESSION_DURATION_REMEMBER: '30d',- SESSION_DURATION_REMEMBER_MS: 2592000000,- SESSION_DURATION_REMEMBER_SECONDS: 2592000,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));// The provider's names are answered here; every other name goes to the real resolver.vi.mock('dns/promises', async (importOriginal) => {diff --git a/server/tests/integration/oidc.test.ts b/server/tests/integration/oidc.test.tsindex 75758d52d..e8d660f5d 100644--- a/server/tests/integration/oidc.test.ts+++ b/server/tests/integration/oidc.test.ts@@ -19,18 +19,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- SESSION_DURATION_REMEMBER: '30d',- SESSION_DURATION_REMEMBER_MS: 2592000000,- SESSION_DURATION_REMEMBER_SECONDS: 2592000,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/orm-request-context-seams.test.ts b/server/tests/integration/orm-request-context-seams.test.tsindex 2c0bc8d00..2205ecc0e 100644--- a/server/tests/integration/orm-request-context-seams.test.ts+++ b/server/tests/integration/orm-request-context-seams.test.ts@@ -36,15 +36,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn(), getOnlineUserIds: vi.fn(() => []) }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/packing.test.ts b/server/tests/integration/packing.test.tsindex 409af8c86..0db5cbea5 100644--- a/server/tests/integration/packing.test.ts+++ b/server/tests/integration/packing.test.ts@@ -11,15 +11,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/passkey.test.ts b/server/tests/integration/passkey.test.tsindex c279ebe6c..966ea7ddb 100644--- a/server/tests/integration/passkey.test.ts+++ b/server/tests/integration/passkey.test.ts@@ -27,15 +27,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/places.test.ts b/server/tests/integration/places.test.tsindex ac42f0eb2..2eca39ce2 100644--- a/server/tests/integration/places.test.ts+++ b/server/tests/integration/places.test.ts@@ -17,15 +17,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/profile.test.ts b/server/tests/integration/profile.test.tsindex 31f3014b3..55f252817 100644--- a/server/tests/integration/profile.test.ts+++ b/server/tests/integration/profile.test.ts@@ -12,15 +12,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/reservations.test.ts b/server/tests/integration/reservations.test.tsindex 4b4e63da3..95c087f7f 100644--- a/server/tests/integration/reservations.test.ts+++ b/server/tests/integration/reservations.test.ts@@ -11,15 +11,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/scheduler-gate.test.ts b/server/tests/integration/scheduler-gate.test.tsindex c37cad99b..49ca9f648 100644--- a/server/tests/integration/scheduler-gate.test.ts+++ b/server/tests/integration/scheduler-gate.test.ts@@ -15,15 +15,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/security.test.ts b/server/tests/integration/security.test.tsindex fba41443c..6efcc08a0 100644--- a/server/tests/integration/security.test.ts+++ b/server/tests/integration/security.test.ts@@ -19,15 +19,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/settings.test.ts b/server/tests/integration/settings.test.tsindex fc7c62607..f0ac0a7de 100644--- a/server/tests/integration/settings.test.ts+++ b/server/tests/integration/settings.test.ts@@ -11,15 +11,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/share.test.ts b/server/tests/integration/share.test.tsindex 31071dbd7..64fd8a6b1 100644--- a/server/tests/integration/share.test.ts+++ b/server/tests/integration/share.test.ts@@ -11,15 +11,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/storage-health-notifier-request-context.test.ts b/server/tests/integration/storage-health-notifier-request-context.test.tsindex 514d938cc..d7f86a9e4 100644--- a/server/tests/integration/storage-health-notifier-request-context.test.ts+++ b/server/tests/integration/storage-health-notifier-request-context.test.ts@@ -27,15 +27,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn(), getOnlineUserIds: vi.fn(() => []) }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/systemNotices.test.ts b/server/tests/integration/systemNotices.test.tsindex 38ffe64a2..7dbcd4c0a 100644--- a/server/tests/integration/systemNotices.test.ts+++ b/server/tests/integration/systemNotices.test.ts@@ -14,15 +14,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/tags.test.ts b/server/tests/integration/tags.test.tsindex f5c444f41..d89716031 100644--- a/server/tests/integration/tags.test.ts+++ b/server/tests/integration/tags.test.ts@@ -11,15 +11,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/todo.test.ts b/server/tests/integration/todo.test.tsindex 5279f03c9..9de8c49ff 100644--- a/server/tests/integration/todo.test.ts+++ b/server/tests/integration/todo.test.ts@@ -11,15 +11,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/trip-access-primitives.test.ts b/server/tests/integration/trip-access-primitives.test.tsindex 91c1f9eed..7ba9e35e0 100644--- a/server/tests/integration/trip-access-primitives.test.ts+++ b/server/tests/integration/trip-access-primitives.test.ts@@ -30,15 +30,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/trips.test.ts b/server/tests/integration/trips.test.tsindex 3cdf3fe91..af105b34c 100644--- a/server/tests/integration/trips.test.ts+++ b/server/tests/integration/trips.test.ts@@ -14,15 +14,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';@@ -299,7 +290,6 @@ describe('Get trip', () => {expect(res.body.error).toMatch(/not found/i);});-it('TRIP-017 — Member can access trip → 200', async () => {const { user: owner } = createUser(testDb);const { user: member } = createUser(testDb);diff --git a/server/tests/integration/uploads-photo-request-context.test.ts b/server/tests/integration/uploads-photo-request-context.test.tsindex 058975cdf..40ac192e1 100644--- a/server/tests/integration/uploads-photo-request-context.test.ts+++ b/server/tests/integration/uploads-photo-request-context.test.ts@@ -36,15 +36,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/uploads-static.test.ts b/server/tests/integration/uploads-static.test.tsindex c588794d8..eb5ffa421 100644--- a/server/tests/integration/uploads-static.test.ts+++ b/server/tests/integration/uploads-static.test.ts@@ -24,15 +24,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn(), getOnlineUserIds: vi.fn(() => []) }));import { db as testDb } from '../../src/db/database';diff --git a/server/tests/integration/vacay.test.ts b/server/tests/integration/vacay.test.tsindex 6067b313f..a2101b355 100644--- a/server/tests/integration/vacay.test.ts+++ b/server/tests/integration/vacay.test.ts@@ -12,15 +12,6 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));vi.mock('../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));// Prevent real HTTP calls (holiday API etc.)diff --git a/server/tests/setup.ts b/server/tests/setup.tsindex 995e352da..ef1d69bbb 100644--- a/server/tests/setup.ts+++ b/server/tests/setup.ts@@ -2,7 +2,7 @@// Environment variables must be set before any module import so that// config.ts, database.ts, etc. pick them up at import time. (Importing from// 'vitest' itself is safe: it is externalized and pulls in no app modules.)-import { afterEach } from 'vitest';+import { afterEach, vi } from 'vitest';// The one app module imported here, and it is deliberately a static import even// though import declarations are hoisted above the process.env writes below.// The chain is nominatim.client -> maps.helpers -> app-config, and its only@@ -17,6 +17,15 @@ import { afterEach } from 'vitest';// app-config with a factory that has no getAppUrl, and the late import then// resolves maps.helpers against that mock and throws.import { setGeoThrottleInterval } from '../src/nest/geo/nominatim.client';+import { resetTestConfig } from './helpers/test-config';++// src/config resolves key material from data/ at import time and writes the+// files it does not find. Every suite gets the fixed values in+// helpers/test-config.ts instead, so none of them declares its own mock; a+// suite that needs other values calls overrideTestConfig(), and the afterEach+// below puts the defaults back. The few suites whose subject is config.ts+// itself call vi.unmock for it.+vi.mock('../src/config', async () => (await import('./helpers/test-config')).TEST_CONFIG);// Fixed encryption key (64 hex chars = 32 bytes) for at-rest crypto in testsprocess.env.ENCRYPTION_KEY = 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2';@@ -49,6 +58,7 @@ interface DynamicImportGlobal {const realSetImmediate = globalThis.setImmediate;afterEach(async () => {await new Promise((resolve) => realSetImmediate(resolve));+ resetTestConfig();});// Nominatim's rate limit is a property of the real service, not of the codediff --git a/server/tests/unit/auto-backup.test.ts b/server/tests/unit/auto-backup.test.tsindex 7ec9c4884..f3ee4aba8 100644--- a/server/tests/unit/auto-backup.test.ts+++ b/server/tests/unit/auto-backup.test.ts@@ -62,11 +62,6 @@ vi.mock('archiver', () => ({ default: archiverMock }));vi.mock('unzipper', () => ({ default: { Extract: vi.fn(), Open: { file: vi.fn() } } }));vi.mock('../../src/db/database', () => dbMock);vi.mock('../../src/nest/audit/audit-log.logger', () => logMock);-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a'.repeat(64),- updateJwtSecret: () => {},-}));import path from 'node:path';import { AutoBackupJob } from '../../src/nest/backup/auto-backup.job';diff --git a/server/tests/unit/config.test.ts b/server/tests/unit/config.test.tsindex 41f0ccc7e..3e86bed6a 100644--- a/server/tests/unit/config.test.ts+++ b/server/tests/unit/config.test.ts@@ -2,6 +2,10 @@ import fs from 'node:fs';import path from 'node:path';import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';+// The subject here is config.ts itself, so this suite takes the real module+// rather than the fixed values the global setup puts in its place.+vi.unmock('../../src/config');+// config.ts resolves its key material at import time, so every case here has to// reset the module registry and re-import it with the file system stubbed out.const ENC_KEY_FILE = path.resolve(__dirname, '../../data/.encryption_key');diff --git a/server/tests/unit/helpers/test-config.test.ts b/server/tests/unit/helpers/test-config.test.tsnew file mode 100644index 000000000..b3cbad305--- /dev/null+++ b/server/tests/unit/helpers/test-config.test.ts@@ -0,0 +1,43 @@+import * as config from '../../../src/config';+import { TEST_CONFIG, overrideTestConfig, resetTestConfig } from '../../helpers/test-config';++import { describe, it, expect } from 'vitest';++describe('test config', () => {+ it('is what src/config answers in every suite', () => {+ expect(config.JWT_SECRET).toBe('test-jwt-secret-for-trek-testing-only');+ expect(config.ENCRYPTION_KEY).toBe(TEST_CONFIG.ENCRYPTION_KEY);+ expect(config.DEFAULT_LANGUAGE).toBe('en');+ expect(config.SESSION_DURATION_SECONDS).toBe(86400);+ expect(config.SESSION_DURATION_REMEMBER_MS).toBe(2592000000);+ });++ it('keeps updateJwtSecret inert, so a rotation in one case does not leak into the next', () => {+ config.updateJwtSecret('rotated');+ expect(config.JWT_SECRET).toBe('test-jwt-secret-for-trek-testing-only');+ });++ it('overrideTestConfig changes what src/config answers until the restore runs', () => {+ const restore = overrideTestConfig({ JWT_SECRET: 'other-secret', DEFAULT_LANGUAGE: 'de' });+ expect(config.JWT_SECRET).toBe('other-secret');+ expect(config.DEFAULT_LANGUAGE).toBe('de');+ restore();+ expect(config.JWT_SECRET).toBe('test-jwt-secret-for-trek-testing-only');+ expect(config.DEFAULT_LANGUAGE).toBe('en');+ });++ it('leaves an override in place for the rest of its own case', () => {+ overrideTestConfig({ ENCRYPTION_KEY: 'case-local-key' });+ expect(config.ENCRYPTION_KEY).toBe('case-local-key');+ });++ it('starts the next case from the defaults again', () => {+ expect(config.ENCRYPTION_KEY).toBe('a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2');+ });++ it('resetTestConfig puts every value back', () => {+ overrideTestConfig({ SESSION_DURATION_SECONDS: 5 });+ resetTestConfig();+ expect(config.SESSION_DURATION_SECONDS).toBe(86400);+ });+});diff --git a/server/tests/unit/mcp/demo-tool-gate.test.ts b/server/tests/unit/mcp/demo-tool-gate.test.tsindex 8458466b0..861b47ba1 100644--- a/server/tests/unit/mcp/demo-tool-gate.test.ts+++ b/server/tests/unit/mcp/demo-tool-gate.test.ts@@ -25,11 +25,6 @@ vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));const DEMO_REFUSAL = {diff --git a/server/tests/unit/mcp/tools-addon-gating.test.ts b/server/tests/unit/mcp/tools-addon-gating.test.tsindex 83a75a0f1..d3e7c6cd9 100644--- a/server/tests/unit/mcp/tools-addon-gating.test.ts+++ b/server/tests/unit/mcp/tools-addon-gating.test.ts@@ -4,21 +4,14 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));-import { resetTestDb } from '../../helpers/test-db';import { createUser, createTrip } from '../../helpers/factories';import { createMcpHarness, parseToolResult, type McpHarness } from '../../helpers/mcp-harness';diff --git a/server/tests/unit/mcp/tools-airtrail.test.ts b/server/tests/unit/mcp/tools-airtrail.test.tsindex 27f9a397f..81097d0f3 100644--- a/server/tests/unit/mcp/tools-airtrail.test.ts+++ b/server/tests/unit/mcp/tools-airtrail.test.ts@@ -11,16 +11,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-assignments-reservations-extra.test.ts b/server/tests/unit/mcp/tools-assignments-reservations-extra.test.tsindex 5d645791e..738f22dbd 100644--- a/server/tests/unit/mcp/tools-assignments-reservations-extra.test.ts+++ b/server/tests/unit/mcp/tools-assignments-reservations-extra.test.ts@@ -5,16 +5,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-assignments.test.ts b/server/tests/unit/mcp/tools-assignments.test.tsindex 0d7992faf..62a4b9403 100644--- a/server/tests/unit/mcp/tools-assignments.test.ts+++ b/server/tests/unit/mcp/tools-assignments.test.ts@@ -5,16 +5,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-atlas-expanded.test.ts b/server/tests/unit/mcp/tools-atlas-expanded.test.tsindex 48e8844e9..8665536bb 100644--- a/server/tests/unit/mcp/tools-atlas-expanded.test.ts+++ b/server/tests/unit/mcp/tools-atlas-expanded.test.ts@@ -7,21 +7,14 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));-import { resetTestDb } from '../../helpers/test-db';import { createUser, createBucketListItem, createVisitedCountry, createTrip, createReservation } from '../../helpers/factories';import { createMcpHarness, parseToolResult, parseResourceResult, type McpHarness } from '../../helpers/mcp-harness';diff --git a/server/tests/unit/mcp/tools-atlas.test.ts b/server/tests/unit/mcp/tools-atlas.test.tsindex 58b41ed12..f99f2bd7c 100644--- a/server/tests/unit/mcp/tools-atlas.test.ts+++ b/server/tests/unit/mcp/tools-atlas.test.ts@@ -5,16 +5,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));diff --git a/server/tests/unit/mcp/tools-budget-advanced.test.ts b/server/tests/unit/mcp/tools-budget-advanced.test.tsindex 28d16cd41..7bb5fa688 100644--- a/server/tests/unit/mcp/tools-budget-advanced.test.ts+++ b/server/tests/unit/mcp/tools-budget-advanced.test.ts@@ -6,16 +6,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-budget.test.ts b/server/tests/unit/mcp/tools-budget.test.tsindex 5830e790b..1c7cca1b5 100644--- a/server/tests/unit/mcp/tools-budget.test.ts+++ b/server/tests/unit/mcp/tools-budget.test.ts@@ -7,16 +7,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-categories.test.ts b/server/tests/unit/mcp/tools-categories.test.tsindex 325f3ef80..7e470bca3 100644--- a/server/tests/unit/mcp/tools-categories.test.ts+++ b/server/tests/unit/mcp/tools-categories.test.ts@@ -10,16 +10,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';import { Client } from '@modelcontextprotocol/sdk/client/index';diff --git a/server/tests/unit/mcp/tools-collab-polls-chat.test.ts b/server/tests/unit/mcp/tools-collab-polls-chat.test.tsindex db618c5bf..89b29c30c 100644--- a/server/tests/unit/mcp/tools-collab-polls-chat.test.ts+++ b/server/tests/unit/mcp/tools-collab-polls-chat.test.ts@@ -9,21 +9,14 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));-import { resetTestDb } from '../../helpers/test-db';import { createUser, createTrip } from '../../helpers/factories';import { createMcpHarness, parseToolResult, parseResourceResult, type McpHarness } from '../../helpers/mcp-harness';diff --git a/server/tests/unit/mcp/tools-collections.test.ts b/server/tests/unit/mcp/tools-collections.test.tsindex 79af7bc65..59a94380e 100644--- a/server/tests/unit/mcp/tools-collections.test.ts+++ b/server/tests/unit/mcp/tools-collections.test.ts@@ -20,11 +20,6 @@ vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser }));const { notifSend } = vi.hoisted(() => ({ notifSend: vi.fn().mockResolvedValue(undefined) }));diff --git a/server/tests/unit/mcp/tools-days-accommodations.test.ts b/server/tests/unit/mcp/tools-days-accommodations.test.tsindex e344f9200..a91838ea5 100644--- a/server/tests/unit/mcp/tools-days-accommodations.test.ts+++ b/server/tests/unit/mcp/tools-days-accommodations.test.ts@@ -9,16 +9,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-days.test.ts b/server/tests/unit/mcp/tools-days.test.tsindex 2440a48ee..a760be2db 100644--- a/server/tests/unit/mcp/tools-days.test.ts+++ b/server/tests/unit/mcp/tools-days.test.ts@@ -7,16 +7,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-feeds-invite.test.ts b/server/tests/unit/mcp/tools-feeds-invite.test.tsindex 8b1503e76..4b052fcc0 100644--- a/server/tests/unit/mcp/tools-feeds-invite.test.ts+++ b/server/tests/unit/mcp/tools-feeds-invite.test.ts@@ -10,16 +10,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));import { resetTestDb } from '../../helpers/test-db';diff --git a/server/tests/unit/mcp/tools-files.test.ts b/server/tests/unit/mcp/tools-files.test.tsindex 2a1693d34..76df3ecda 100644--- a/server/tests/unit/mcp/tools-files.test.ts+++ b/server/tests/unit/mcp/tools-files.test.ts@@ -13,16 +13,10 @@ import { db as testDb } from '../../../src/db/database';import fs from 'node:fs';import nodePath from 'node:path';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-help-addons.test.ts b/server/tests/unit/mcp/tools-help-addons.test.tsindex 6c73aa57a..18200ff10 100644--- a/server/tests/unit/mcp/tools-help-addons.test.ts+++ b/server/tests/unit/mcp/tools-help-addons.test.ts@@ -5,16 +5,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-journey.test.ts b/server/tests/unit/mcp/tools-journey.test.tsindex bf9e41311..914d84640 100644--- a/server/tests/unit/mcp/tools-journey.test.ts+++ b/server/tests/unit/mcp/tools-journey.test.ts@@ -6,16 +6,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock, broadcastToUser: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-leg-transport-mode.test.ts b/server/tests/unit/mcp/tools-leg-transport-mode.test.tsindex e4dd125de..37eacca2e 100644--- a/server/tests/unit/mcp/tools-leg-transport-mode.test.ts+++ b/server/tests/unit/mcp/tools-leg-transport-mode.test.ts@@ -5,16 +5,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-memories.test.ts b/server/tests/unit/mcp/tools-memories.test.tsindex 5089ae97e..b63b93d68 100644--- a/server/tests/unit/mcp/tools-memories.test.ts+++ b/server/tests/unit/mcp/tools-memories.test.ts@@ -10,16 +10,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock, broadcastToUser: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-notes.test.ts b/server/tests/unit/mcp/tools-notes.test.tsindex c7960ace8..2fab98d18 100644--- a/server/tests/unit/mcp/tools-notes.test.ts+++ b/server/tests/unit/mcp/tools-notes.test.ts@@ -8,16 +8,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock, unlinkSyncMock } = vi.hoisted(() => ({broadcastMock: vi.fn(),diff --git a/server/tests/unit/mcp/tools-notifications.test.ts b/server/tests/unit/mcp/tools-notifications.test.tsindex 9df3fa25a..48d3a659b 100644--- a/server/tests/unit/mcp/tools-notifications.test.ts+++ b/server/tests/unit/mcp/tools-notifications.test.ts@@ -12,16 +12,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));diff --git a/server/tests/unit/mcp/tools-packing-advanced.test.ts b/server/tests/unit/mcp/tools-packing-advanced.test.tsindex 48585933f..fb10fe80e 100644--- a/server/tests/unit/mcp/tools-packing-advanced.test.ts+++ b/server/tests/unit/mcp/tools-packing-advanced.test.ts@@ -9,16 +9,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-packing.test.ts b/server/tests/unit/mcp/tools-packing.test.tsindex c1c8e4bfb..2e17ee15f 100644--- a/server/tests/unit/mcp/tools-packing.test.ts+++ b/server/tests/unit/mcp/tools-packing.test.ts@@ -14,16 +14,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-places.test.ts b/server/tests/unit/mcp/tools-places.test.tsindex f4fc46a54..2d2aa38f8 100644--- a/server/tests/unit/mcp/tools-places.test.ts+++ b/server/tests/unit/mcp/tools-places.test.ts@@ -11,16 +11,10 @@ import { DomainError } from '../../../src/nest/common/domain-error';import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-plugin-pois.test.ts b/server/tests/unit/mcp/tools-plugin-pois.test.tsindex 0208e2219..3a91dda74 100644--- a/server/tests/unit/mcp/tools-plugin-pois.test.ts+++ b/server/tests/unit/mcp/tools-plugin-pois.test.ts@@ -13,11 +13,6 @@ vi.mock('../../../src/db/database', async () => {return buildDbMock(createSnapshotTestDb());});vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/nest/plugins/kill-switch', () => ({ pluginsEnabled }));import { db as testDb } from '../../../src/db/database';diff --git a/server/tests/unit/mcp/tools-plugin-search.test.ts b/server/tests/unit/mcp/tools-plugin-search.test.tsindex b20e4f401..deedaca0f 100644--- a/server/tests/unit/mcp/tools-plugin-search.test.ts+++ b/server/tests/unit/mcp/tools-plugin-search.test.ts@@ -5,7 +5,6 @@import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';import { db as testDb } from '../../../src/db/database';-const { broadcastMock, pluginsEnabled } = vi.hoisted(() => ({broadcastMock: vi.fn(),pluginsEnabled: vi.fn(() => true),@@ -16,11 +15,6 @@ vi.mock('../../../src/db/database', async () => {return buildDbMock(createSnapshotTestDb());});vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));// The admin kill switch reads live env; drive it from the test instead of the process.vi.mock('../../../src/nest/plugins/kill-switch', () => ({ pluginsEnabled }));diff --git a/server/tests/unit/mcp/tools-prompts.test.ts b/server/tests/unit/mcp/tools-prompts.test.tsindex 3451d6e70..6bcff83a1 100644--- a/server/tests/unit/mcp/tools-prompts.test.ts+++ b/server/tests/unit/mcp/tools-prompts.test.ts@@ -22,16 +22,10 @@ import { Client } from '@modelcontextprotocol/sdk/client/index';import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory';import { ErrorCode } from '@modelcontextprotocol/sdk/types';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));@@ -104,8 +98,6 @@ const readModelStub = {getTripSummary: (tripId: number, viewerUserId?: number) => mockGetTripSummary(tripId, viewerUserId),} as never;--// The three remaining prompts moved to their domains' @McpController classes:// packing-list, budget-overview and the static-token notice. Built over the same// in-memory DB so the cases below keep asserting real rows.diff --git a/server/tests/unit/mcp/tools-reservations.test.ts b/server/tests/unit/mcp/tools-reservations.test.tsindex 134491de5..cfd35201f 100644--- a/server/tests/unit/mcp/tools-reservations.test.ts+++ b/server/tests/unit/mcp/tools-reservations.test.ts@@ -5,16 +5,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-roadtrip.test.ts b/server/tests/unit/mcp/tools-roadtrip.test.tsindex 95a35c2fc..beb4cd04d 100644--- a/server/tests/unit/mcp/tools-roadtrip.test.ts+++ b/server/tests/unit/mcp/tools-roadtrip.test.ts@@ -11,16 +11,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));import { resetTestDb, setAddonEnabled } from '../../helpers/test-db';diff --git a/server/tests/unit/mcp/tools-settings.test.ts b/server/tests/unit/mcp/tools-settings.test.tsindex 48477a9c9..f8cf38df3 100644--- a/server/tests/unit/mcp/tools-settings.test.ts+++ b/server/tests/unit/mcp/tools-settings.test.ts@@ -12,16 +12,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));diff --git a/server/tests/unit/mcp/tools-share.test.ts b/server/tests/unit/mcp/tools-share.test.tsindex fb9507238..d532e458d 100644--- a/server/tests/unit/mcp/tools-share.test.ts+++ b/server/tests/unit/mcp/tools-share.test.ts@@ -7,16 +7,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));import { resetTestDb } from '../../helpers/test-db';diff --git a/server/tests/unit/mcp/tools-tags-maps-weather.test.ts b/server/tests/unit/mcp/tools-tags-maps-weather.test.tsindex 3bc0cb307..52cbcfd32 100644--- a/server/tests/unit/mcp/tools-tags-maps-weather.test.ts+++ b/server/tests/unit/mcp/tools-tags-maps-weather.test.ts@@ -7,16 +7,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-todos.test.ts b/server/tests/unit/mcp/tools-todos.test.tsindex 83b6abe79..7ca4e023a 100644--- a/server/tests/unit/mcp/tools-todos.test.ts+++ b/server/tests/unit/mcp/tools-todos.test.ts@@ -11,16 +11,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-transit.test.ts b/server/tests/unit/mcp/tools-transit.test.tsindex afaf2fcee..8f9fd2047 100644--- a/server/tests/unit/mcp/tools-transit.test.ts+++ b/server/tests/unit/mcp/tools-transit.test.ts@@ -7,7 +7,6 @@ import { resetTestDb } from '../../helpers/test-db';import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';import { db as testDb } from '../../../src/db/database';-const { broadcastMock } = vi.hoisted(() => ({broadcastMock: vi.fn(),}));@@ -17,11 +16,6 @@ vi.mock('../../../src/db/database', async () => {return buildDbMock(createSnapshotTestDb());});vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));import { ReservationsService } from '../../../src/nest/reservations/reservations.service';import type { TransitPlace } from '../../../src/nest/transit/transit.helpers';diff --git a/server/tests/unit/mcp/tools-transports.test.ts b/server/tests/unit/mcp/tools-transports.test.tsindex fd6a4acd0..8b828a48d 100644--- a/server/tests/unit/mcp/tools-transports.test.ts+++ b/server/tests/unit/mcp/tools-transports.test.ts@@ -7,16 +7,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-trip-members.test.ts b/server/tests/unit/mcp/tools-trip-members.test.tsindex e65a444e0..17d16ee31 100644--- a/server/tests/unit/mcp/tools-trip-members.test.ts+++ b/server/tests/unit/mcp/tools-trip-members.test.ts@@ -7,16 +7,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-trip-warnings.test.ts b/server/tests/unit/mcp/tools-trip-warnings.test.tsindex edf873024..5fa240fa8 100644--- a/server/tests/unit/mcp/tools-trip-warnings.test.ts+++ b/server/tests/unit/mcp/tools-trip-warnings.test.ts@@ -5,7 +5,6 @@import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';import { db as testDb } from '../../../src/db/database';-const { broadcastMock, pluginsEnabled } = vi.hoisted(() => ({broadcastMock: vi.fn(),pluginsEnabled: vi.fn(() => true),@@ -16,11 +15,6 @@ vi.mock('../../../src/db/database', async () => {return buildDbMock(createSnapshotTestDb());});vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));// The admin kill switch reads live env; drive it from the test instead of the process.vi.mock('../../../src/nest/plugins/kill-switch', () => ({ pluginsEnabled }));diff --git a/server/tests/unit/mcp/tools-trips.test.ts b/server/tests/unit/mcp/tools-trips.test.tsindex cb8292980..d7b0a5f2c 100644--- a/server/tests/unit/mcp/tools-trips.test.ts+++ b/server/tests/unit/mcp/tools-trips.test.ts@@ -10,16 +10,10 @@import { describe, it, expect, vi, beforeAll, beforeEach, afterEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/mcp/tools-vacay.test.ts b/server/tests/unit/mcp/tools-vacay.test.tsindex 038cd5016..0bfcb2e73 100644--- a/server/tests/unit/mcp/tools-vacay.test.ts+++ b/server/tests/unit/mcp/tools-vacay.test.ts@@ -17,16 +17,10 @@ import { DomainError } from '../../../src/nest/common/domain-error';import { describe, it, expect, vi, beforeAll, beforeEach, afterEach, afterAll } from 'vitest';import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/nest/admin.service.test.ts b/server/tests/unit/nest/admin.service.test.tsindex 1f011747d..52774cad8 100644--- a/server/tests/unit/nest/admin.service.test.ts+++ b/server/tests/unit/nest/admin.service.test.ts@@ -31,15 +31,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- // The session cases sign real session tokens.- SESSION_DURATION_SECONDS: 86400,- SESSION_DURATION_REMEMBER_SECONDS: 2592000,- updateJwtSecret: () => {},-}));vi.mock('../../../src/nest/common/crypto/apiKeyCrypto', () => ({encrypt_api_key: (v: string) => v,decrypt_api_key: (v: string) => v,diff --git a/server/tests/unit/nest/admin.version-notification.test.ts b/server/tests/unit/nest/admin.version-notification.test.tsindex d601f30b0..ba05bf7ce 100644--- a/server/tests/unit/nest/admin.version-notification.test.ts+++ b/server/tests/unit/nest/admin.version-notification.test.ts@@ -27,12 +27,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcastToUser: vi.fn() }));// Mock MCP to avoid session side-effectsvi.mock('../../../src/mcp', () => ({ revokeUserSessions: vi.fn(), invalidateMcpSessions: vi.fn() }));diff --git a/server/tests/unit/nest/assignments.service.test.ts b/server/tests/unit/nest/assignments.service.test.tsindex d9e9b1298..d1123ca19 100644--- a/server/tests/unit/nest/assignments.service.test.ts+++ b/server/tests/unit/nest/assignments.service.test.ts@@ -22,12 +22,6 @@ vi.mock('../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {} };});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));import { db as testDb } from '../../../src/db/database';diff --git a/server/tests/unit/nest/auth-core/jwt-verify.test.ts b/server/tests/unit/nest/auth-core/jwt-verify.test.tsindex e9e7aded7..5580948cd 100644--- a/server/tests/unit/nest/auth-core/jwt-verify.test.ts+++ b/server/tests/unit/nest/auth-core/jwt-verify.test.ts@@ -28,13 +28,12 @@ import {verifiedSessionClaims,verifyJwtAndLoadUser,} from '../../../../src/nest/auth-core/jwt-verify';+import { TEST_CONFIG } from '../../../helpers/test-config';import type { Request } from 'express';import jwt from 'jsonwebtoken';import { describe, it, expect, vi, afterEach } from 'vitest';-vi.mock('../../../../src/config', () => ({ JWT_SECRET: 'test-secret' }));-function makeReq(overrides: {cookies?: Record<string, string>;@@ -125,7 +124,7 @@ describe('verifyJwtAndLoadUser', () => {role: 'user',password_version: 0,});- const token = jwt.sign({ id: 1 }, 'test-secret', { algorithm: 'HS256' });+ const token = jwt.sign({ id: 1 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256' });expect(await verifyJwtAndLoadUser(token, users, sessionsRepo())).toEqual({id: 1,@@ -143,12 +142,16 @@ describe('verifyJwtAndLoadUser', () => {it('AUTH-JWT-003: returns null when the user no longer exists', async () => {const users = usersRepo(null);expect(- await verifyJwtAndLoadUser(jwt.sign({ id: 99999 }, 'test-secret', { algorithm: 'HS256' }), users, sessionsRepo()),+ await verifyJwtAndLoadUser(+ jwt.sign({ id: 99999 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256' }),+ users,+ sessionsRepo(),+ ),).toBeNull();});it('AUTH-JWT-004: returns null for an expired token', async () => {- const expired = jwt.sign({ id: 1, exp: Math.floor(Date.now() / 1000) - 3600 }, 'test-secret', {+ const expired = jwt.sign({ id: 1, exp: Math.floor(Date.now() / 1000) - 3600 }, TEST_CONFIG.JWT_SECRET, {algorithm: 'HS256',});expect(await verifyJwtAndLoadUser(expired, usersRepo(null), sessionsRepo())).toBeNull();@@ -174,7 +177,7 @@ describe('verifyJwtAndLoadUser', () => {role: 'user',password_version: 0,});- const mfaToken = jwt.sign({ id: 1, purpose: 'mfa_login' }, 'test-secret', { algorithm: 'HS256' });+ const mfaToken = jwt.sign({ id: 1, purpose: 'mfa_login' }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256' });expect(await verifyJwtAndLoadUser(mfaToken, users, sessionsRepo())).toBeNull();expect(users.findByIdWithPasswordVersion).not.toHaveBeenCalled();@@ -188,7 +191,7 @@ describe('verifyJwtAndLoadUser', () => {role: 'user',password_version: 2,});- const stale = jwt.sign({ id: 1, pv: 1 }, 'test-secret', { algorithm: 'HS256' });+ const stale = jwt.sign({ id: 1, pv: 1 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256' });expect(await verifyJwtAndLoadUser(stale, users, sessionsRepo())).toBeNull();});@@ -201,7 +204,7 @@ describe('verifyJwtAndLoadUser', () => {role: 'user',password_version: 2,});- const current = jwt.sign({ id: 1, pv: 2 }, 'test-secret', { algorithm: 'HS256' });+ const current = jwt.sign({ id: 1, pv: 2 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256' });expect(await verifyJwtAndLoadUser(current, users, sessionsRepo())).not.toBeNull();});@@ -218,7 +221,7 @@ describe('verifyJwtAndLoadUser', () => {role: 'user',password_version: null,});- const legacy = jwt.sign({ id: 1 }, 'test-secret', { algorithm: 'HS256' });+ const legacy = jwt.sign({ id: 1 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256' });expect(await verifyJwtAndLoadUser(legacy, users, sessionsRepo())).not.toBeNull();});@@ -231,7 +234,7 @@ describe('verifyJwtAndLoadUser', () => {role: 'user',password_version: 1,});- const legacy = jwt.sign({ id: 1 }, 'test-secret', { algorithm: 'HS256' });+ const legacy = jwt.sign({ id: 1 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256' });expect(await verifyJwtAndLoadUser(legacy, users, sessionsRepo())).toBeNull();});@@ -243,7 +246,7 @@ describe('verifyJwtAndLoadUser: the session check', () => {it('AUTH-JWT-011: a token without a jti is never looked up, so tokens from before the upgrade keep working', async () => {const sessions = sessionsRepo();- const legacy = jwt.sign({ id: 1, pv: 0 }, 'test-secret', { algorithm: 'HS256' });+ const legacy = jwt.sign({ id: 1, pv: 0 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256' });expect(await verifyJwtAndLoadUser(legacy, usersRepo(alice), sessions)).not.toBeNull();expect(sessions.findActive).not.toHaveBeenCalled();@@ -251,7 +254,7 @@ describe('verifyJwtAndLoadUser: the session check', () => {it('AUTH-JWT-012: a token naming an active session of its own user passes', async () => {const sessions = sessionsRepo({ id: SID, last_seen_at: dbNow() });- const token = jwt.sign({ id: 1, pv: 0 }, 'test-secret', { algorithm: 'HS256', jwtid: SID });+ const token = jwt.sign({ id: 1, pv: 0 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256', jwtid: SID });expect(await verifyJwtAndLoadUser(token, usersRepo(alice), sessions)).toEqual({id: 1,@@ -267,14 +270,14 @@ describe('verifyJwtAndLoadUser: the session check', () => {});it('AUTH-JWT-013: a token whose session is revoked, expired or unknown is refused', async () => {- const token = jwt.sign({ id: 1, pv: 0 }, 'test-secret', { algorithm: 'HS256', jwtid: SID });+ const token = jwt.sign({ id: 1, pv: 0 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256', jwtid: SID });expect(await verifyJwtAndLoadUser(token, usersRepo(alice), sessionsRepo(null))).toBeNull();});it('AUTH-JWT-014: a jti that is not a string is refused without a lookup', async () => {const sessions = sessionsRepo({ id: SID, last_seen_at: dbNow() });- const token = jwt.sign({ id: 1, pv: 0, jti: 42 }, 'test-secret', { algorithm: 'HS256' });+ const token = jwt.sign({ id: 1, pv: 0, jti: 42 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256' });expect(await verifyJwtAndLoadUser(token, usersRepo(alice), sessions)).toBeNull();expect(sessions.findActive).not.toHaveBeenCalled();@@ -282,7 +285,7 @@ describe('verifyJwtAndLoadUser: the session check', () => {it('AUTH-JWT-015: the password_version gate runs before the session lookup', async () => {const sessions = sessionsRepo({ id: SID, last_seen_at: dbNow() });- const stale = jwt.sign({ id: 1, pv: 0 }, 'test-secret', { algorithm: 'HS256', jwtid: SID });+ const stale = jwt.sign({ id: 1, pv: 0 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256', jwtid: SID });expect(await verifyJwtAndLoadUser(stale, usersRepo({ ...alice, password_version: 1 }), sessions)).toBeNull();expect(sessions.findActive).not.toHaveBeenCalled();@@ -291,7 +294,7 @@ describe('verifyJwtAndLoadUser: the session check', () => {it('AUTH-JWT-016: last_seen_at is refreshed once it is older than the touch interval, not before', async () => {vi.useFakeTimers();vi.setSystemTime(new Date('2026-10-08T12:00:00Z'));- const token = jwt.sign({ id: 1, pv: 0 }, 'test-secret', { algorithm: 'HS256', jwtid: SID });+ const token = jwt.sign({ id: 1, pv: 0 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256', jwtid: SID });const fresh = sessionsRepo({ id: SID, last_seen_at: '2026-10-08 11:58:00' });expect(await verifyJwtAndLoadUser(token, usersRepo(alice), fresh)).not.toBeNull();@@ -307,7 +310,7 @@ describe('verifyJwtAndLoadUser: the session check', () => {const sessions = sessionsRepo({ id: SID, last_seen_at: '2020-01-01 00:00:00' }, async () => {throw new Error('database is locked');});- const token = jwt.sign({ id: 1, pv: 0 }, 'test-secret', { algorithm: 'HS256', jwtid: SID });+ const token = jwt.sign({ id: 1, pv: 0 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256', jwtid: SID });expect(await verifyJwtAndLoadUser(token, usersRepo(alice), sessions)).not.toBeNull();expect(sessions.touchLastSeen).toHaveBeenCalled();@@ -316,31 +319,31 @@ describe('verifyJwtAndLoadUser: the session check', () => {describe('currentSessionId', () => {it('reads the jti of the cookie token', () => {- const token = jwt.sign({ id: 1 }, 'test-secret', { algorithm: 'HS256', jwtid: 'sid-1' });+ const token = jwt.sign({ id: 1 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256', jwtid: 'sid-1' });expect(currentSessionId(makeReq({ cookies: { trek_session: token } }))).toBe('sid-1');});it('falls back to the bearer token', () => {- const token = jwt.sign({ id: 1 }, 'test-secret', { algorithm: 'HS256', jwtid: 'sid-2' });+ const token = jwt.sign({ id: 1 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256', jwtid: 'sid-2' });expect(currentSessionId(makeReq({ headers: { authorization: `Bearer ${token}` } }))).toBe('sid-2');});it('is undefined for a token without a jti, and without any token', () => {expect(- currentSessionId(makeReq({ cookies: { trek_session: jwt.sign({ id: 1 }, 'test-secret') } })),+ currentSessionId(makeReq({ cookies: { trek_session: jwt.sign({ id: 1 }, TEST_CONFIG.JWT_SECRET) } })),).toBeUndefined();expect(currentSessionId(makeReq())).toBeUndefined();});it('is undefined for a jti that is not a string', () => {- const token = jwt.sign({ id: 1, jti: 7 }, 'test-secret', { algorithm: 'HS256' });+ const token = jwt.sign({ id: 1, jti: 7 }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256' });expect(currentSessionId(makeReq({ cookies: { trek_session: token } }))).toBeUndefined();});});describe('verifiedSessionClaims', () => {it('returns the claims of a well-signed token, even an expired one', () => {- const expired = jwt.sign({ id: 3, jti: 'sid', exp: Math.floor(Date.now() / 1000) - 60 }, 'test-secret', {+ const expired = jwt.sign({ id: 3, jti: 'sid', exp: Math.floor(Date.now() / 1000) - 60 }, TEST_CONFIG.JWT_SECRET, {algorithm: 'HS256',});expect(verifiedSessionClaims(expired)).toEqual(expect.objectContaining({ id: 3, jti: 'sid' }));@@ -352,9 +355,9 @@ describe('verifiedSessionClaims', () => {it('refuses a purpose-scoped token and one without a numeric user id', () => {expect(- verifiedSessionClaims(jwt.sign({ id: 3, purpose: 'mfa_login' }, 'test-secret', { algorithm: 'HS256' })),+ verifiedSessionClaims(jwt.sign({ id: 3, purpose: 'mfa_login' }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256' })),).toBeNull();- expect(verifiedSessionClaims(jwt.sign({ id: 'x' }, 'test-secret', { algorithm: 'HS256' }))).toBeNull();+ expect(verifiedSessionClaims(jwt.sign({ id: 'x' }, TEST_CONFIG.JWT_SECRET, { algorithm: 'HS256' }))).toBeNull();});it('is null without a token', () => {diff --git a/server/tests/unit/nest/auth.helpers.test.ts b/server/tests/unit/nest/auth.helpers.test.tsindex 6c02dc6df..440a845fc 100644--- a/server/tests/unit/nest/auth.helpers.test.ts+++ b/server/tests/unit/nest/auth.helpers.test.ts@@ -9,7 +9,6 @@*/import { describe, it, expect, vi } from 'vitest';-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));vi.mock('../../../src/nest/common/crypto/apiKeyCrypto', () => ({decrypt_api_key: vi.fn((v) => v),maybe_encrypt_api_key: vi.fn((v) => v),diff --git a/server/tests/unit/nest/auth.service.test.ts b/server/tests/unit/nest/auth.service.test.tsindex 35c290819..3a4a877b7 100644--- a/server/tests/unit/nest/auth.service.test.ts+++ b/server/tests/unit/nest/auth.service.test.ts@@ -25,14 +25,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- SESSION_DURATION_SECONDS: 86400,- SESSION_DURATION_REMEMBER_SECONDS: 2592000,- updateJwtSecret: () => {},-}));vi.mock('../../../src/nest/common/crypto/mfaCrypto', () => ({encryptMfaSecret: vi.fn((s) => `enc:${s}`),decryptMfaSecret: vi.fn((s: string) => s.replace('enc:', '')),@@ -50,6 +42,7 @@ vi.mock('../../../src/mcp/sessionManager', () => ({ revokeUserSessions: vi.fn()// Imports (after mocks)// ---------------------------------------------------------------------------+import { TEST_CONFIG } from '../../helpers/test-config';import { asLegacyResult } from '../../helpers/domain-error';import { db as testDb } from '../../../src/db/database';import { describe, it, expect, beforeAll, beforeEach, afterEach, afterAll, vi } from 'vitest';@@ -648,7 +641,7 @@ describe('verifyMfaLogin — validation', () => {it('AUTH-DB-039: returns 401 when mfa_token has wrong purpose', async () => {// eslint-disable-next-line @typescript-eslint/no-require-importsconst jwt = require('jsonwebtoken');- const tok = jwt.sign({ id: 1, purpose: 'wrong' }, 'test-secret', { expiresIn: '5m', algorithm: 'HS256' });+ const tok = jwt.sign({ id: 1, purpose: 'wrong' }, TEST_CONFIG.JWT_SECRET, { expiresIn: '5m', algorithm: 'HS256' });const result = await asLegacyResult(svc.verifyMfaLogin({ mfa_token: tok, code: '123456' }));expect(result.status).toBe(401);expect(result.error).toMatch(/invalid/i);@@ -657,7 +650,7 @@ describe('verifyMfaLogin — validation', () => {it('AUTH-DB-040: returns 401 when user not found for valid mfa_token', async () => {// eslint-disable-next-line @typescript-eslint/no-require-importsconst jwt = require('jsonwebtoken');- const tok = jwt.sign({ id: 99999, purpose: 'mfa_login' }, 'test-secret', { expiresIn: '5m', algorithm: 'HS256' });+ const tok = jwt.sign({ id: 99999, purpose: 'mfa_login' }, TEST_CONFIG.JWT_SECRET, { expiresIn: '5m', algorithm: 'HS256' });const result = await asLegacyResult(svc.verifyMfaLogin({ mfa_token: tok, code: '123456' }));expect(result.status).toBe(401);});@@ -1190,7 +1183,6 @@ describe('resetPassword', () => {});});-// ---------------------------------------------------------------------------// Quirk fixes after the DI fold (trailing fix(server) commit): AUTH-DB-089+.// The relocation carried these verbatim; the fixes land on top with a pin each.diff --git a/server/tests/unit/nest/backup.impl.test.ts b/server/tests/unit/nest/backup.impl.test.tsindex 1a25280a1..30d75acd4 100644--- a/server/tests/unit/nest/backup.impl.test.ts+++ b/server/tests/unit/nest/backup.impl.test.ts@@ -68,11 +68,6 @@ const logMock = vi.hoisted(() => ({ logInfo: vi.fn(), logError: vi.fn(), logWarnvi.mock('../../../src/db/database', () => dbMock);vi.mock('../../../src/nest/audit/audit-log.logger', () => logMock);-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a'.repeat(64),- updateJwtSecret: () => {},-}));vi.mock('fs', () => ({ default: fsMock, ...fsMock }));vi.mock('archiver', () => ({ default: archiverMock }));vi.mock('unzipper', () => ({ default: unzipperMock }));diff --git a/server/tests/unit/nest/budget.service.db.test.ts b/server/tests/unit/nest/budget.service.db.test.tsindex 61d11e682..3976bc99e 100644--- a/server/tests/unit/nest/budget.service.db.test.ts+++ b/server/tests/unit/nest/budget.service.db.test.ts@@ -17,12 +17,6 @@ vi.mock('../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {} };});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));// Frozen snapshot of the rates in play in #1543 (rates[X] = units of X per 1 base).diff --git a/server/tests/unit/nest/calendar.service.test.ts b/server/tests/unit/nest/calendar.service.test.tsindex 2964f6a4f..d3c8fc8e6 100644--- a/server/tests/unit/nest/calendar.service.test.ts+++ b/server/tests/unit/nest/calendar.service.test.ts@@ -22,12 +22,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcast } = vi.hoisted(() => ({ broadcast: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast }));diff --git a/server/tests/unit/nest/channel-override.test.ts b/server/tests/unit/nest/channel-override.test.tsindex 177a8f295..6d81e1e35 100644--- a/server/tests/unit/nest/channel-override.test.ts+++ b/server/tests/unit/nest/channel-override.test.ts@@ -16,7 +16,6 @@ vi.mock('../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {}, canAccessTrip: () => null, isOwner: () => false, getPlaceWithTags: () => null };});-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'x'.repeat(40), ENCRYPTION_KEY: 'a'.repeat(64), updateJwtSecret: () => {} }));vi.mock('../../../src/nest/common/crypto/apiKeyCrypto', () => ({ decrypt_api_key: (v: string) => v, maybe_encrypt_api_key: (v: string) => v, encrypt_api_key: (v: string) => v }));const { sendMailMock } = vi.hoisted(() => ({ sendMailMock: vi.fn().mockResolvedValue({ accepted: ['[email protected]'] }) }));vi.mock('nodemailer', () => ({ default: { createTransport: vi.fn(() => ({ sendMail: sendMailMock, verify: vi.fn() })) } }));diff --git a/server/tests/unit/nest/collab.service.test.ts b/server/tests/unit/nest/collab.service.test.tsindex c6c0c5a3d..e856bfa1c 100644--- a/server/tests/unit/nest/collab.service.test.ts+++ b/server/tests/unit/nest/collab.service.test.ts@@ -25,12 +25,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));// Stub checkSsrf so linkPreview tests can control SSRF behaviour. Typed from the realdiff --git a/server/tests/unit/nest/collections.service.test.ts b/server/tests/unit/nest/collections.service.test.tsindex 28c60725e..a5b54d42f 100644--- a/server/tests/unit/nest/collections.service.test.ts+++ b/server/tests/unit/nest/collections.service.test.ts@@ -26,11 +26,6 @@ const { broadcastToUser } = vi.hoisted(() => ({ broadcastToUser: vi.fn() }));import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcastToUser, broadcast: vi.fn() }));const notifSend = vi.fn().mockResolvedValue(undefined);diff --git a/server/tests/unit/nest/dawarich-suggestions.service.test.ts b/server/tests/unit/nest/dawarich-suggestions.service.test.tsindex c1ab8930a..9a509dbb3 100644--- a/server/tests/unit/nest/dawarich-suggestions.service.test.ts+++ b/server/tests/unit/nest/dawarich-suggestions.service.test.ts@@ -17,11 +17,6 @@ import { createSnapshotTestDb } from '../../helpers/db-mock';const testDb = createSnapshotTestDb();-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));import { DAWARICH_BUCKET_SCAN_LIMIT } from '@trek/shared';diff --git a/server/tests/unit/nest/dawarich.service.test.ts b/server/tests/unit/nest/dawarich.service.test.tsindex 2857c3ee4..0736b55dd 100644--- a/server/tests/unit/nest/dawarich.service.test.ts+++ b/server/tests/unit/nest/dawarich.service.test.ts@@ -47,13 +47,9 @@ import { createSnapshotTestDb } from '../../helpers/db-mock';const testDb = createSnapshotTestDb();-// Same fixed key the global setup exports, pinned here so the at-rest round-// trip cannot depend on what is lying in server/data.-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));+// The at-rest round trip uses the fixed key of the global test config+// (tests/helpers/test-config.ts), so it cannot depend on what is lying in+// server/data.// The whole ssrfGuard surface, not only `checkSsrf`: several modules on the// import graph pull other names off it, and a factory mock that omits onediff --git a/server/tests/unit/nest/day-notes.service.test.ts b/server/tests/unit/nest/day-notes.service.test.tsindex 89dfedb58..8f9ff94dc 100644--- a/server/tests/unit/nest/day-notes.service.test.ts+++ b/server/tests/unit/nest/day-notes.service.test.ts@@ -21,11 +21,6 @@ vi.mock('../../../src/db/database', async () => {getPlaceWithTags: () => null,};});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));import { db as testDb } from '../../../src/db/database';diff --git a/server/tests/unit/nest/day-removal.service.test.ts b/server/tests/unit/nest/day-removal.service.test.tsindex ff6bde21b..f830871bc 100644--- a/server/tests/unit/nest/day-removal.service.test.ts+++ b/server/tests/unit/nest/day-removal.service.test.ts@@ -14,11 +14,6 @@ vi.mock('../../../src/db/database', async () => {// Trip access reads through TripsRepository now; the module only hands out the handle.return { db, closeDb: () => {}, reinitialize: () => {} };});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));import { db as testDb } from '../../../src/db/database';diff --git a/server/tests/unit/nest/days.service.test.ts b/server/tests/unit/nest/days.service.test.tsindex cc317c0a6..ee0d9eb50 100644--- a/server/tests/unit/nest/days.service.test.ts+++ b/server/tests/unit/nest/days.service.test.ts@@ -22,12 +22,6 @@ vi.mock('../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {} };});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));import { db as testDb } from '../../../src/db/database';diff --git a/server/tests/unit/nest/files.service.test.ts b/server/tests/unit/nest/files.service.test.tsindex 4bc8caf4b..1f3cb784a 100644--- a/server/tests/unit/nest/files.service.test.ts+++ b/server/tests/unit/nest/files.service.test.ts@@ -31,11 +31,6 @@ vi.mock('../../../src/db/database', async () => {});import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));const checkPermission = vi.fn(() => true);diff --git a/server/tests/unit/nest/immich.service.test.ts b/server/tests/unit/nest/immich.service.test.tsindex bc045e489..feb6a9300 100644--- a/server/tests/unit/nest/immich.service.test.ts+++ b/server/tests/unit/nest/immich.service.test.ts@@ -16,12 +16,6 @@ vi.mock('../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {}, canAccessTrip: () => null, isOwner: () => false, getPlaceWithTags: () => null };});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'x'.repeat(40),- ENCRYPTION_KEY: 'a'.repeat(64),- updateJwtSecret: () => {},-}));-const { decryptMock, maybeEncryptMock } = vi.hoisted(() => ({decryptMock: vi.fn((v: string) => v),maybeEncryptMock: vi.fn((v: string) => v),diff --git a/server/tests/unit/nest/journey-book.service.test.ts b/server/tests/unit/nest/journey-book.service.test.tsindex 804e23d68..056e8ea54 100644--- a/server/tests/unit/nest/journey-book.service.test.ts+++ b/server/tests/unit/nest/journey-book.service.test.ts@@ -22,12 +22,6 @@ vi.mock('../../../src/db/database', async () => {};});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcastToUser: vi.fn() }));import { db as testDb } from '../../../src/db/database';diff --git a/server/tests/unit/nest/journey-domain.service.test.ts b/server/tests/unit/nest/journey-domain.service.test.tsindex db1e1df37..241c0861e 100644--- a/server/tests/unit/nest/journey-domain.service.test.ts+++ b/server/tests/unit/nest/journey-domain.service.test.ts@@ -24,12 +24,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcastToUser: vi.fn() }));import { db as testDb } from '../../../src/db/database';diff --git a/server/tests/unit/nest/journey-share.service.test.ts b/server/tests/unit/nest/journey-share.service.test.tsindex 9225e7393..cb5952a74 100644--- a/server/tests/unit/nest/journey-share.service.test.ts+++ b/server/tests/unit/nest/journey-share.service.test.ts@@ -21,13 +21,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));-import { db as testDb } from '../../../src/db/database';import { resetTestDb } from '../../helpers/test-db';import { createUser, createJourney, createJourneyEntry, addJourneyContributor } from '../../helpers/factories';diff --git a/server/tests/unit/nest/journey-stats.service.test.ts b/server/tests/unit/nest/journey-stats.service.test.tsindex 5bc35c2b0..9e4b5de8c 100644--- a/server/tests/unit/nest/journey-stats.service.test.ts+++ b/server/tests/unit/nest/journey-stats.service.test.ts@@ -22,12 +22,6 @@ vi.mock('../../../src/db/database', async () => {};});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcastToUser: vi.fn() }));/*diff --git a/server/tests/unit/nest/maps.amap.test.ts b/server/tests/unit/nest/maps.amap.test.tsindex 99bd180b0..a48e4eded 100644--- a/server/tests/unit/nest/maps.amap.test.ts+++ b/server/tests/unit/nest/maps.amap.test.ts@@ -49,8 +49,6 @@ vi.mock('../../../src/nest/common/crypto/apiKeyCrypto', () => ({maybe_encrypt_api_key: (v: string | null) => v,}));-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));-// The index answers search and autocomplete before any keyed provider, and// trekPlacesEnabled fails open, so a service-level case that reached it with// the Amap fetch stub in place would leave the runner for places.liketrek.com.diff --git a/server/tests/unit/nest/maps.area.test.ts b/server/tests/unit/nest/maps.area.test.tsindex 38ba39df7..704a7910e 100644--- a/server/tests/unit/nest/maps.area.test.ts+++ b/server/tests/unit/nest/maps.area.test.ts@@ -15,8 +15,6 @@ vi.mock('../../../src/nest/maps/trek-places.client', async (importOriginal) => (trekPlacesArea: mockArea,}));-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));-import { buildMapsService } from '../../helpers/maps-service';import type { PlacePhotoCacheService } from '../../../src/nest/place-photos/place-photo-cache.service';import { noGoogleQuota } from '../../helpers/google-quota';diff --git a/server/tests/unit/nest/maps.autocomplete.test.ts b/server/tests/unit/nest/maps.autocomplete.test.tsindex c519c6b6d..577e22e1c 100644--- a/server/tests/unit/nest/maps.autocomplete.test.ts+++ b/server/tests/unit/nest/maps.autocomplete.test.ts@@ -21,8 +21,6 @@ vi.mock('../../../src/nest/maps/trek-places.client', async (importOriginal) => (trekPlacesSearch: mockSearch,}));-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));-import { buildMapsService } from '../../helpers/maps-service';import type { PlacePhotoCacheService } from '../../../src/nest/place-photos/place-photo-cache.service';import { noGoogleQuota } from '../../helpers/google-quota';@@ -49,7 +47,6 @@ vi.mock('../../../src/app-config', async (importOriginal) => {};});-const INPUT = 'Café Kröpel';const hit = (over: Record<string, unknown> = {}) => ({diff --git a/server/tests/unit/nest/maps.curated-images.test.ts b/server/tests/unit/nest/maps.curated-images.test.tsindex 63cbabb2e..3ab1c541c 100644--- a/server/tests/unit/nest/maps.curated-images.test.ts+++ b/server/tests/unit/nest/maps.curated-images.test.ts@@ -15,8 +15,6 @@ vi.mock('../../../src/db/database', () => ({db: { prepare: () => ({ get: () => undefined, run: () => undefined, all: () => [] }) },}));-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));-vi.mock('../../../src/utils/ssrfGuard', () => ({safeFetchFollow: vi.fn(),checkSsrf: vi.fn(async () => ({ allowed: true })),diff --git a/server/tests/unit/nest/maps.geocode.test.ts b/server/tests/unit/nest/maps.geocode.test.tsindex 754db7082..c87a61473 100644--- a/server/tests/unit/nest/maps.geocode.test.ts+++ b/server/tests/unit/nest/maps.geocode.test.ts@@ -28,8 +28,6 @@ vi.mock('../../../src/nest/geo/nominatim.client', async (importOriginal) => ({nominatimFetch: mockNominatim,}));-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));-import { buildMapsService } from '../../helpers/maps-service';import type { PlacePhotoCacheService } from '../../../src/nest/place-photos/place-photo-cache.service';import { noGoogleQuota } from '../../helpers/google-quota';diff --git a/server/tests/unit/nest/maps.gers-details.test.ts b/server/tests/unit/nest/maps.gers-details.test.tsindex 9090a22f0..603dc7ffc 100644--- a/server/tests/unit/nest/maps.gers-details.test.ts+++ b/server/tests/unit/nest/maps.gers-details.test.ts@@ -15,8 +15,6 @@ vi.mock('../../../src/nest/maps/trek-places.client', async (importOriginal) => (trekPlacesById: mockById,}));-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));-import { MapsService } from '../../../src/nest/maps/maps.service';import { buildMapsParts } from '../../helpers/maps-service';import type { OsmClient } from '../../../src/nest/maps/providers/osm.client';diff --git a/server/tests/unit/nest/maps.google-quota.test.ts b/server/tests/unit/nest/maps.google-quota.test.tsindex 735c7ac1c..61759423f 100644--- a/server/tests/unit/nest/maps.google-quota.test.ts+++ b/server/tests/unit/nest/maps.google-quota.test.ts@@ -9,8 +9,6 @@ vi.mock('../../../src/db/database', () => ({db: { prepare: () => ({ get: () => undefined, run: () => undefined, all: () => [] }) },}));-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));-import { GooglePlacesClient } from '../../../src/nest/maps/providers/google-places.provider';import { buildMapsService } from '../../helpers/maps-service';import { GoogleTransitProvider } from '../../../src/nest/transit/google-transit.provider';diff --git a/server/tests/unit/nest/maps.identity.test.ts b/server/tests/unit/nest/maps.identity.test.tsindex 7581529f7..4854b047c 100644--- a/server/tests/unit/nest/maps.identity.test.ts+++ b/server/tests/unit/nest/maps.identity.test.ts@@ -11,8 +11,6 @@ vi.mock('../../../src/db/database', () => ({db: { prepare: () => ({ get: () => undefined, run: () => undefined, all: () => [] }) },}));-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));-vi.mock('../../../src/utils/ssrfGuard', () => ({safeFetchFollow: vi.fn(),checkSsrf: vi.fn(async () => ({ allowed: true })),diff --git a/server/tests/unit/nest/maps.nearby.test.ts b/server/tests/unit/nest/maps.nearby.test.tsindex aff6a3694..dc9047380 100644--- a/server/tests/unit/nest/maps.nearby.test.ts+++ b/server/tests/unit/nest/maps.nearby.test.ts@@ -16,8 +16,6 @@ vi.mock('../../../src/nest/maps/trek-places.client', async (importOriginal) => (trekPlacesNearby: mockNearby,}));-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));-import { MapsService } from '../../../src/nest/maps/maps.service';import { buildMapsService } from '../../helpers/maps-service';import {diff --git a/server/tests/unit/nest/maps.pois.test.ts b/server/tests/unit/nest/maps.pois.test.tsindex 66360cc8c..12dbb64b4 100644--- a/server/tests/unit/nest/maps.pois.test.ts+++ b/server/tests/unit/nest/maps.pois.test.ts@@ -23,8 +23,6 @@ vi.mock('../../../src/nest/maps/trek-places.client', async (importOriginal) => (trekPlacesNearby: mockNearby,}));-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));-import { MapsService } from '../../../src/nest/maps/maps.service';import { buildMapsParts } from '../../helpers/maps-service';import type { OsmClient } from '../../../src/nest/maps/providers/osm.client';diff --git a/server/tests/unit/nest/maps.search-merge.test.ts b/server/tests/unit/nest/maps.search-merge.test.tsindex 93346ef2e..88ac4afde 100644--- a/server/tests/unit/nest/maps.search-merge.test.ts+++ b/server/tests/unit/nest/maps.search-merge.test.ts@@ -28,8 +28,6 @@ vi.mock('../../../src/nest/geo/nominatim.client', async (importOriginal) => ({nominatimFetch: mockNominatim,}));-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));-import { buildMapsService } from '../../helpers/maps-service';import type { PlacePhotoCacheService } from '../../../src/nest/place-photos/place-photo-cache.service';import { noGoogleQuota } from '../../helpers/google-quota';@@ -56,7 +54,6 @@ vi.mock('../../../src/app-config', async (importOriginal) => {};});-/** An index row, far enough from the OSM one below not to be deduped. */const indexHit = (name: string, lat = 35.31, lng = 139.53) => ({gers: name.toLowerCase().replace(/\W/g, ''),diff --git a/server/tests/unit/nest/maps.service.test.ts b/server/tests/unit/nest/maps.service.test.tsindex 4a73329ef..15056b44a 100644--- a/server/tests/unit/nest/maps.service.test.ts+++ b/server/tests/unit/nest/maps.service.test.ts@@ -133,11 +133,6 @@ vi.mock('../../../src/nest/common/crypto/apiKeyCrypto', () => ({maybe_encrypt_api_key: (v: string | null) => v,}));-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: '0'.repeat(64),-}));-// pois(), searchPlaces() and autocompletePlaces() all ask the index before the// old path, and trekPlacesEnabled fails open — so a case that reaches one of// them with no fetch stub in place leaves the runner for places.liketrek.com.diff --git a/server/tests/unit/nest/memories-access.service.test.ts b/server/tests/unit/nest/memories-access.service.test.tsindex dd3fa2bd5..87f2d8e1b 100644--- a/server/tests/unit/nest/memories-access.service.test.ts+++ b/server/tests/unit/nest/memories-access.service.test.ts@@ -21,13 +21,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));-const { mockSafeFetch } = vi.hoisted(() => ({mockSafeFetch: vi.fn(),}));diff --git a/server/tests/unit/nest/notification-preferences.service.test.ts b/server/tests/unit/nest/notification-preferences.service.test.tsindex 581fb923d..fcaeb923c 100644--- a/server/tests/unit/nest/notification-preferences.service.test.ts+++ b/server/tests/unit/nest/notification-preferences.service.test.ts@@ -19,12 +19,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/nest/common/crypto/apiKeyCrypto', () => ({decrypt_api_key: (v: string | null) => v,maybe_encrypt_api_key: (v: string) => v,diff --git a/server/tests/unit/nest/notifications.inapp-prefs.test.ts b/server/tests/unit/nest/notifications.inapp-prefs.test.tsindex ab5a08c90..ced25f028 100644--- a/server/tests/unit/nest/notifications.inapp-prefs.test.ts+++ b/server/tests/unit/nest/notifications.inapp-prefs.test.ts@@ -22,13 +22,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));-// Mock WebSocket broadcast — must use vi.hoisted() so broadcastMock is available// when the vi.mock factory is evaluated (factories are hoisted before const declarations)const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));diff --git a/server/tests/unit/nest/notifications.service.test.ts b/server/tests/unit/nest/notifications.service.test.tsindex 29a6670c8..29a1af919 100644--- a/server/tests/unit/nest/notifications.service.test.ts+++ b/server/tests/unit/nest/notifications.service.test.ts@@ -24,12 +24,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/nest/common/crypto/apiKeyCrypto', () => ({decrypt_api_key: (v: string | null) => v,maybe_encrypt_api_key: (v: string) => v,diff --git a/server/tests/unit/nest/notifications/push-subscriptions.service.test.ts b/server/tests/unit/nest/notifications/push-subscriptions.service.test.tsindex ab557fef9..1248e7ea3 100644--- a/server/tests/unit/nest/notifications/push-subscriptions.service.test.ts+++ b/server/tests/unit/nest/notifications/push-subscriptions.service.test.ts@@ -20,11 +20,6 @@ vi.mock('../../../../src/db/database', async () => {isOwner: () => false,};});-vi.mock('../../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));import { db as testDb } from '../../../../src/db/database';import { resetTestDb } from '../../../helpers/test-db';diff --git a/server/tests/unit/nest/notifications/vapid-keys.service.test.ts b/server/tests/unit/nest/notifications/vapid-keys.service.test.tsindex 64bfc5e71..94fb02f83 100644--- a/server/tests/unit/nest/notifications/vapid-keys.service.test.ts+++ b/server/tests/unit/nest/notifications/vapid-keys.service.test.ts@@ -22,11 +22,6 @@ vi.mock('../../../../src/db/database', async () => {isOwner: () => false,};});-vi.mock('../../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { logInfo, logError } = vi.hoisted(() => ({ logInfo: vi.fn(), logError: vi.fn() }));vi.mock('../../../../src/nest/audit/audit-log.logger', () => ({LOG_LEVEL: 'error',diff --git a/server/tests/unit/nest/notifications/web-push-dispatch.test.ts b/server/tests/unit/nest/notifications/web-push-dispatch.test.tsindex 66c30d815..e6482ad12 100644--- a/server/tests/unit/nest/notifications/web-push-dispatch.test.ts+++ b/server/tests/unit/nest/notifications/web-push-dispatch.test.ts@@ -21,11 +21,6 @@ vi.mock('../../../../src/db/database', async () => {isOwner: () => false,};});-vi.mock('../../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { safeFetchFollow, logError } = vi.hoisted(() => ({ safeFetchFollow: vi.fn(), logError: vi.fn() }));vi.mock('../../../../src/nest/audit/audit-log.logger', () => ({LOG_LEVEL: 'error',diff --git a/server/tests/unit/nest/notifications/web-push.service.test.ts b/server/tests/unit/nest/notifications/web-push.service.test.tsindex d02facb53..7fa04ed28 100644--- a/server/tests/unit/nest/notifications/web-push.service.test.ts+++ b/server/tests/unit/nest/notifications/web-push.service.test.ts@@ -21,11 +21,6 @@ vi.mock('../../../../src/db/database', async () => {isOwner: () => false,};});-vi.mock('../../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { logInfo, logError, safeFetchFollow } = vi.hoisted(() => ({logInfo: vi.fn(),logError: vi.fn(),diff --git a/server/tests/unit/nest/oauth.service.test.ts b/server/tests/unit/nest/oauth.service.test.tsindex 2eab9f527..bb9c5cca1 100644--- a/server/tests/unit/nest/oauth.service.test.ts+++ b/server/tests/unit/nest/oauth.service.test.ts@@ -24,12 +24,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/nest/common/crypto/apiKeyCrypto', () => ({encrypt_api_key: (v: string) => v,decrypt_api_key: (v: string) => v,diff --git a/server/tests/unit/nest/oidc.service.test.ts b/server/tests/unit/nest/oidc.service.test.tsindex 508f58922..ef74e0462 100644--- a/server/tests/unit/nest/oidc.service.test.ts+++ b/server/tests/unit/nest/oidc.service.test.ts@@ -24,15 +24,6 @@ vi.mock('../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {} };});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- SESSION_DURATION_SECONDS: 86400,- SESSION_DURATION_REMEMBER_SECONDS: 2592000,- updateJwtSecret: () => {},-}));-// Construction insurance for the injected AuthService's import graph (same set// as auth.service.test.ts) — TripMembershipService is deliberately the real one,// not a stub: OIDC-SVC-045 asserts the actual trip_members row a trip-bounddiff --git a/server/tests/unit/nest/packing.service.test.ts b/server/tests/unit/nest/packing.service.test.tsindex d127ae556..54dd69baa 100644--- a/server/tests/unit/nest/packing.service.test.ts+++ b/server/tests/unit/nest/packing.service.test.ts@@ -26,13 +26,6 @@ vi.mock('../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {} };});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));-const { broadcastMock } = vi.hoisted(() => ({ broadcastMock: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: broadcastMock }));diff --git a/server/tests/unit/nest/passkey.service.test.ts b/server/tests/unit/nest/passkey.service.test.tsindex 3cc26af76..c8d94ed12 100644--- a/server/tests/unit/nest/passkey.service.test.ts+++ b/server/tests/unit/nest/passkey.service.test.ts@@ -34,15 +34,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- SESSION_DURATION_SECONDS: 86400,- SESSION_DURATION_REMEMBER_SECONDS: 2592000,- updateJwtSecret: () => {},-}));-// Construction insurance for the injected AuthService's import graph (same set// as oidc.service.test.ts / auth.service.test.ts).vi.mock('../../../src/nest/common/crypto/mfaCrypto', () => ({diff --git a/server/tests/unit/nest/photo-resolver.service.test.ts b/server/tests/unit/nest/photo-resolver.service.test.tsindex fb30fc8e3..6490affc7 100644--- a/server/tests/unit/nest/photo-resolver.service.test.ts+++ b/server/tests/unit/nest/photo-resolver.service.test.ts@@ -17,11 +17,6 @@ vi.mock('../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {}, canAccessTrip: () => null, isOwner: () => false, getPlaceWithTags: () => null };});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'x'.repeat(40),- ENCRYPTION_KEY: 'a'.repeat(64),- updateJwtSecret: () => {},-}));vi.mock('../../../src/nest/common/crypto/apiKeyCrypto', () => ({decrypt_api_key: (v: string) => v,encrypt_api_key: (v: string) => v,diff --git a/server/tests/unit/nest/place-enrichment.brand.test.ts b/server/tests/unit/nest/place-enrichment.brand.test.tsindex a51901b90..a046e1506 100644--- a/server/tests/unit/nest/place-enrichment.brand.test.ts+++ b/server/tests/unit/nest/place-enrichment.brand.test.ts@@ -27,8 +27,6 @@ vi.mock('../../../src/utils/ssrfGuard', () => ({SsrfBlockedError: class extends Error {},}));-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));-import { PlaceEnrichmentService } from '../../../src/nest/place-enrichment/place-enrichment.service';import { readBrandIdentity } from '../../../src/nest/maps/maps.service';import type { MapsService } from '../../../src/nest/maps/maps.service';diff --git a/server/tests/unit/nest/place-enrichment.description.test.ts b/server/tests/unit/nest/place-enrichment.description.test.tsindex 7aa236774..d88c0c5b3 100644--- a/server/tests/unit/nest/place-enrichment.description.test.ts+++ b/server/tests/unit/nest/place-enrichment.description.test.ts@@ -25,8 +25,6 @@ vi.mock('../../../src/utils/ssrfGuard', () => ({SsrfBlockedError: class extends Error {},}));-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));-const { mockTrekPlacesById } = vi.hoisted(() => ({mockTrekPlacesById: vi.fn(async (_gers: string): Promise<unknown> => null),}));@@ -397,7 +395,6 @@ describe('filling Google gaps from the free sources', () => {});})-describe("the description on the place's own website", () => {// The ordinary case, and the one nothing covered before: a restaurant has no// encyclopaedia article and never will, but it does publish a summary ofdiff --git a/server/tests/unit/nest/place-enrichment.service.test.ts b/server/tests/unit/nest/place-enrichment.service.test.tsindex 770d82fc9..1b662b647 100644--- a/server/tests/unit/nest/place-enrichment.service.test.ts+++ b/server/tests/unit/nest/place-enrichment.service.test.ts@@ -28,8 +28,6 @@ vi.mock('../../../src/utils/ssrfGuard', () => ({SsrfBlockedError: class extends Error {},}));-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));-// Reached for any `gers:` place id, where the real one is an outbound request// to the TREK Places API. Only this export is replaced; the record shaping the// rest of the module provides stays as it is.diff --git a/server/tests/unit/nest/places.controller.test.ts b/server/tests/unit/nest/places.controller.test.tsindex 0f4feaf90..20d4b97db 100644--- a/server/tests/unit/nest/places.controller.test.ts+++ b/server/tests/unit/nest/places.controller.test.ts@@ -7,11 +7,6 @@ const { legacyDatabaseAccess } = vi.hoisted(() => ({}),}));-vi.mock('../../../src/config', () => ({- ENCRYPTION_KEY: 'test-only-inert-key',- JWT_SECRET: 'test-only-inert-secret',- updateJwtSecret: vi.fn(),-}));vi.mock('../../../src/db/database', () => ({db: new Proxy({}, {get: (_target, property: string | symbol) => legacyDatabaseAccess(property),diff --git a/server/tests/unit/nest/places.helpers.test.ts b/server/tests/unit/nest/places.helpers.test.tsindex 6d74e8b7b..cc5bcee80 100644--- a/server/tests/unit/nest/places.helpers.test.ts+++ b/server/tests/unit/nest/places.helpers.test.ts@@ -9,11 +9,6 @@ vi.mock('../../../src/db/database', () => ({db: { prepare: vi.fn() },getPlaceWithTags: vi.fn(),}));-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));import {COORD_DEDUP_TOLERANCE,diff --git a/server/tests/unit/nest/places.service.test.ts b/server/tests/unit/nest/places.service.test.tsindex 6d7983439..c2a4a9f4e 100644--- a/server/tests/unit/nest/places.service.test.ts+++ b/server/tests/unit/nest/places.service.test.ts@@ -37,13 +37,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));-// Spy on the photo-cache reclaim hook so delete tests assert the wiring without// touching disk. The removal logic itself is covered in placePhotoCache.test.ts.// Injected stub since the photo-cache fold (was a partial path mock).diff --git a/server/tests/unit/nest/reminder-jobs.service.test.ts b/server/tests/unit/nest/reminder-jobs.service.test.tsindex 943bafabc..14a4acc0c 100644--- a/server/tests/unit/nest/reminder-jobs.service.test.ts+++ b/server/tests/unit/nest/reminder-jobs.service.test.ts@@ -15,16 +15,10 @@ vi.mock('../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {}, getPlaceWithTags: () => null, canAccessTrip: () => undefined, isOwner: () => false };});-const logMock = vi.hoisted(() => ({ LOG_LEVEL: 'error', logInfo: vi.fn(), logError: vi.fn(), logWarn: vi.fn(), logDebug: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn(), broadcastToUser: vi.fn() }));vi.mock('../../../src/nest/audit/audit-log.logger', () => logMock);-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a'.repeat(64),- updateJwtSecret: () => {},-}));import { db as testDb } from '../../../src/db/database';import { createUser, createTrip, createTodoItem, setAppSetting, setNotificationChannels } from '../../helpers/factories';diff --git a/server/tests/unit/nest/session-renewal.interceptor.test.ts b/server/tests/unit/nest/session-renewal.interceptor.test.tsindex f4099da29..8a50a8add 100644--- a/server/tests/unit/nest/session-renewal.interceptor.test.ts+++ b/server/tests/unit/nest/session-renewal.interceptor.test.ts@@ -11,17 +11,6 @@ import type { CallHandler, ExecutionContext } from '@nestjs/common';import { of, lastValueFrom } from 'rxjs';import jwt from 'jsonwebtoken';-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- SESSION_DURATION_REMEMBER: '30d',- SESSION_DURATION_REMEMBER_MS: 2592000000,- SESSION_DURATION_REMEMBER_SECONDS: 2592000,- updateJwtSecret: () => {},-}));-import { SessionRenewalInterceptor } from '../../../src/nest/auth/session-renewal.interceptor';import type { SessionsService } from '../../../src/nest/sessions/sessions.service';diff --git a/server/tests/unit/nest/settings.service.test.ts b/server/tests/unit/nest/settings.service.test.tsindex d21a2b77e..6dde66b1d 100644--- a/server/tests/unit/nest/settings.service.test.ts+++ b/server/tests/unit/nest/settings.service.test.ts@@ -26,13 +26,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));-// Passthrough crypto — value comes back unchanged for most testsvi.mock('../../../src/nest/common/crypto/apiKeyCrypto', () => ({maybe_encrypt_api_key: (v: string) => v,diff --git a/server/tests/unit/nest/share.service.test.ts b/server/tests/unit/nest/share.service.test.tsindex 1fd1b2924..1198b8d5b 100644--- a/server/tests/unit/nest/share.service.test.ts+++ b/server/tests/unit/nest/share.service.test.ts@@ -18,13 +18,6 @@ vi.mock('../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {} };});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));-const checkPermission = vi.fn();const permissionsStub = { checkPermission } as unknown as PermissionsService;diff --git a/server/tests/unit/nest/storage/storage-admin.service.test.ts b/server/tests/unit/nest/storage/storage-admin.service.test.tsindex 66eed2a7f..3a266f187 100644--- a/server/tests/unit/nest/storage/storage-admin.service.test.ts+++ b/server/tests/unit/nest/storage/storage-admin.service.test.ts@@ -7,8 +7,6 @@ vi.mock('../../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {} };});-vi.mock('../../../../src/config', () => ({ ENCRYPTION_KEY: 'storage-admin-test-key' }));-import { db as testDb } from '../../../../src/db/database';import fs from 'node:fs';import os from 'node:os';diff --git a/server/tests/unit/nest/storage/storage-jobs.service.test.ts b/server/tests/unit/nest/storage/storage-jobs.service.test.tsindex acf253c90..b7fb44f18 100644--- a/server/tests/unit/nest/storage/storage-jobs.service.test.ts+++ b/server/tests/unit/nest/storage/storage-jobs.service.test.ts@@ -7,8 +7,6 @@ vi.mock('../../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {} };});-vi.mock('../../../../src/config', () => ({ ENCRYPTION_KEY: 'storage-jobs-test-key' }));-import { db as testDb } from '../../../../src/db/database';import fs from 'node:fs';import os from 'node:os';diff --git a/server/tests/unit/nest/storage/storage-registry.service.test.ts b/server/tests/unit/nest/storage/storage-registry.service.test.tsindex 26331d34b..4d3708781 100644--- a/server/tests/unit/nest/storage/storage-registry.service.test.ts+++ b/server/tests/unit/nest/storage/storage-registry.service.test.ts@@ -11,9 +11,6 @@ vi.mock('../../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {} };});--vi.mock('../../../../src/config', () => ({ ENCRYPTION_KEY: 'storage-registry-test-key' }));-import { db as testDb } from '../../../../src/db/database';import fs from 'node:fs';import os from 'node:os';diff --git a/server/tests/unit/nest/storage/storage-secrets.test.ts b/server/tests/unit/nest/storage/storage-secrets.test.tsindex 044509a0e..eb20c741e 100644--- a/server/tests/unit/nest/storage/storage-secrets.test.ts+++ b/server/tests/unit/nest/storage/storage-secrets.test.ts@@ -1,6 +1,4 @@-import { describe, it, expect, vi } from 'vitest';--vi.mock('../../../../src/config', () => ({ ENCRYPTION_KEY: 'storage-secrets-test-key' }));+import { describe, it, expect } from 'vitest';import { MASKED_SETTING_VALUE, type StorageConfig } from '@trek/shared';import {@@ -38,7 +36,6 @@ const LOCAL_ONLY: StorageConfig = {categories: {},};-describe('encryptStorageSecrets', () => {it('encrypts plaintext secrets and round-trips through decrypt', () => {const out = encryptStorageSecrets(s3Config('sk-plain'));diff --git a/server/tests/unit/nest/storage/storage-stats.service.test.ts b/server/tests/unit/nest/storage/storage-stats.service.test.tsindex 378e2a1f8..ef6893de8 100644--- a/server/tests/unit/nest/storage/storage-stats.service.test.ts+++ b/server/tests/unit/nest/storage/storage-stats.service.test.ts@@ -7,8 +7,6 @@ vi.mock('../../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {} };});-vi.mock('../../../../src/config', () => ({ ENCRYPTION_KEY: 'storage-stats-test-key' }));-import { db as testDb } from '../../../../src/db/database';import fs from 'node:fs';import os from 'node:os';diff --git a/server/tests/unit/nest/synology.service.test.ts b/server/tests/unit/nest/synology.service.test.tsindex cf37e916c..f6b8d8170 100644--- a/server/tests/unit/nest/synology.service.test.ts+++ b/server/tests/unit/nest/synology.service.test.ts@@ -18,12 +18,6 @@ vi.mock('../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {}, canAccessTrip: () => null, isOwner: () => false, getPlaceWithTags: () => null };});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'x'.repeat(40),- ENCRYPTION_KEY: 'a'.repeat(64),- updateJwtSecret: () => {},-}));-const { decryptMock, maybeEncryptMock } = vi.hoisted(() => ({decryptMock: vi.fn((v: string) => v),maybeEncryptMock: vi.fn((v: string) => v),diff --git a/server/tests/unit/nest/todo.service.test.ts b/server/tests/unit/nest/todo.service.test.tsindex 8ee70233d..0c3129ce7 100644--- a/server/tests/unit/nest/todo.service.test.ts+++ b/server/tests/unit/nest/todo.service.test.ts@@ -17,12 +17,6 @@ vi.mock('../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {} };});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast: vi.fn() }));import { db as testDb } from '../../../src/db/database';diff --git a/server/tests/unit/nest/tours.controller.test.ts b/server/tests/unit/nest/tours.controller.test.tsindex b840e9627..edcd1add5 100644--- a/server/tests/unit/nest/tours.controller.test.ts+++ b/server/tests/unit/nest/tours.controller.test.ts@@ -17,11 +17,6 @@ const { legacyDatabaseAccess } = vi.hoisted(() => ({}),}));-vi.mock('../../../src/config', () => ({- ENCRYPTION_KEY: 'test-only-inert-key',- JWT_SECRET: 'test-only-inert-secret',- updateJwtSecret: vi.fn(),-}));vi.mock('../../../src/db/database', () => ({db: new Proxy({}, {get: (_target, property: string | symbol) => legacyDatabaseAccess(property),diff --git a/server/tests/unit/nest/tours.gpx.atomic.test.ts b/server/tests/unit/nest/tours.gpx.atomic.test.tsindex 8e98159ca..24630d6e4 100644--- a/server/tests/unit/nest/tours.gpx.atomic.test.ts+++ b/server/tests/unit/nest/tours.gpx.atomic.test.ts@@ -13,11 +13,6 @@ vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));import { db as testDb } from '../../../src/db/database';import type { PlacePhotoCacheService } from '../../../src/nest/place-photos/place-photo-cache.service';diff --git a/server/tests/unit/nest/tours.permissions.boundaries.mock-only.test.ts b/server/tests/unit/nest/tours.permissions.boundaries.mock-only.test.tsindex 3469618b9..17f130332 100644--- a/server/tests/unit/nest/tours.permissions.boundaries.mock-only.test.ts+++ b/server/tests/unit/nest/tours.permissions.boundaries.mock-only.test.ts@@ -20,11 +20,6 @@ const { legacyDatabaseAccess } = vi.hoisted(() => ({}),}));-vi.mock('../../../src/config', () => ({- ENCRYPTION_KEY: 'test-only-inert-key',- JWT_SECRET: 'test-only-inert-secret',- updateJwtSecret: vi.fn(),-}));vi.mock('../../../src/db/database', () => ({db: new Proxy({}, {get: (_target, property: string | symbol) => legacyDatabaseAccess(property),diff --git a/server/tests/unit/nest/tours.permissions.test.ts b/server/tests/unit/nest/tours.permissions.test.tsindex 969c93593..6e040b9aa 100644--- a/server/tests/unit/nest/tours.permissions.test.ts+++ b/server/tests/unit/nest/tours.permissions.test.ts@@ -18,11 +18,6 @@ const { legacyDatabaseAccess } = vi.hoisted(() => ({}),}));-vi.mock('../../../src/config', () => ({- ENCRYPTION_KEY: 'test-only-inert-key',- JWT_SECRET: 'test-only-inert-secret',- updateJwtSecret: vi.fn(),-}));vi.mock('../../../src/db/database', () => ({db: new Proxy({}, {get: (_target, property: string | symbol) => legacyDatabaseAccess(property),diff --git a/server/tests/unit/nest/tours.service.permissions.test.ts b/server/tests/unit/nest/tours.service.permissions.test.tsindex de64ce500..f9ea0b0ad 100644--- a/server/tests/unit/nest/tours.service.permissions.test.ts+++ b/server/tests/unit/nest/tours.service.permissions.test.ts@@ -14,11 +14,6 @@ const { legacyDatabaseAccess } = vi.hoisted(() => ({}),}));-vi.mock('../../../src/config', () => ({- ENCRYPTION_KEY: 'test-only-inert-key',- JWT_SECRET: 'test-only-inert-secret',- updateJwtSecret: vi.fn(),-}));vi.mock('../../../src/db/database', () => ({db: new Proxy({}, {get: (_target, property: string | symbol) => legacyDatabaseAccess(property),diff --git a/server/tests/unit/nest/tours.service.test.ts b/server/tests/unit/nest/tours.service.test.tsindex e7bd97e86..7228be6ad 100644--- a/server/tests/unit/nest/tours.service.test.ts+++ b/server/tests/unit/nest/tours.service.test.ts@@ -14,11 +14,6 @@ vi.mock('../../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));import { db as testDb } from '../../../src/db/database';import { tourCreateRequestSchema, type TourCreateRequest } from '@trek/shared';diff --git a/server/tests/unit/nest/trip-invite.service.test.ts b/server/tests/unit/nest/trip-invite.service.test.tsindex eb0bfa2a5..701bdb7f2 100644--- a/server/tests/unit/nest/trip-invite.service.test.ts+++ b/server/tests/unit/nest/trip-invite.service.test.ts@@ -20,11 +20,6 @@ vi.mock('../../../src/db/database', async () => {isOwner: () => false,};});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));import { db as testDb } from '../../../src/db/database';import { resetTestDb } from '../../helpers/test-db';diff --git a/server/tests/unit/nest/trip-members.service.test.ts b/server/tests/unit/nest/trip-members.service.test.tsindex b9b7fd722..b53ff2f81 100644--- a/server/tests/unit/nest/trip-members.service.test.ts+++ b/server/tests/unit/nest/trip-members.service.test.ts@@ -28,11 +28,6 @@ vi.mock('../../../src/db/database', async () => {});import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));vi.mock('../../../src/websocket', () => ({ broadcast }));// notifyInvite reaches the bridge through a dynamic import — keep the send in scope// but out of the transports.diff --git a/server/tests/unit/nest/trip-read-model.service.test.ts b/server/tests/unit/nest/trip-read-model.service.test.tsindex 44bd3a35f..732989892 100644--- a/server/tests/unit/nest/trip-read-model.service.test.ts+++ b/server/tests/unit/nest/trip-read-model.service.test.ts@@ -25,12 +25,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcast } = vi.hoisted(() => ({ broadcast: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast }));diff --git a/server/tests/unit/nest/trips.service.test.ts b/server/tests/unit/nest/trips.service.test.tsindex 5d258beb0..705d894b6 100644--- a/server/tests/unit/nest/trips.service.test.ts+++ b/server/tests/unit/nest/trips.service.test.ts@@ -29,12 +29,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));const { broadcast } = vi.hoisted(() => ({ broadcast: vi.fn() }));vi.mock('../../../src/websocket', () => ({ broadcast }));// notifyInvite fires a notification via a dynamic import — keep it out of unit scopediff --git a/server/tests/unit/nest/unified-memories.service.test.ts b/server/tests/unit/nest/unified-memories.service.test.tsindex 9c821080e..702da0cef 100644--- a/server/tests/unit/nest/unified-memories.service.test.ts+++ b/server/tests/unit/nest/unified-memories.service.test.ts@@ -20,13 +20,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));-import { db as testDb } from '../../../src/db/database';import { resetTestDb, setAddonEnabled } from '../../helpers/test-db';import { createUser, createTrip } from '../../helpers/factories';diff --git a/server/tests/unit/nest/vacay.service.test.ts b/server/tests/unit/nest/vacay.service.test.tsindex 410a7560c..c2ba54ed7 100644--- a/server/tests/unit/nest/vacay.service.test.ts+++ b/server/tests/unit/nest/vacay.service.test.ts@@ -15,12 +15,6 @@ vi.mock('../../../src/db/database', async () => {return mock;});--vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));// Mock websocket so notifyPlanUsers doesn't throwvi.mock('../../../src/websocket', () => ({ broadcastToUser: vi.fn() }));// shareCalendar fires a notification after inserting — keep that out of unit scopediff --git a/server/tests/unit/nest/wiring.test.ts b/server/tests/unit/nest/wiring.test.tsindex dcc30a346..31a71c723 100644--- a/server/tests/unit/nest/wiring.test.ts+++ b/server/tests/unit/nest/wiring.test.ts@@ -1,27 +1,10 @@-import { describe, it, expect, vi } from 'vitest';+import { describe, it, expect } from 'vitest';import { HttpException } from '@nestjs/common';import { Test } from '@nestjs/testing';import { AppModule } from '../../../src/nest/app.module';import { FeaturesController } from '../../../src/nest/health/features.controller';import { AdminGuard } from '../../../src/nest/auth-core/admin.guard';-vi.mock('../../../src/config', async () => {- const { readEnv } = await import('../../../src/app-config');- const env = readEnv();- return {- ENCRYPTION_KEY: 'wiring-test-inert-encryption-key',- JWT_SECRET: 'wiring-test-inert-jwt-secret',- updateJwtSecret: vi.fn(),- DEFAULT_LANGUAGE: env.app.defaultLanguage,- SESSION_DURATION: env.session.duration,- SESSION_DURATION_MS: env.session.durationMs,- SESSION_DURATION_SECONDS: env.session.durationSeconds,- SESSION_DURATION_REMEMBER: env.session.durationRemember,- SESSION_DURATION_REMEMBER_MS: env.session.durationRememberMs,- SESSION_DURATION_REMEMBER_SECONDS: env.session.durationRememberSeconds,- };-});-function ctx(user: unknown) {return { switchToHttp: () => ({ getRequest: () => ({ user }) }) } as never;}diff --git a/server/tests/unit/plugins/operator-egress.test.ts b/server/tests/unit/plugins/operator-egress.test.tsindex 43590d4ef..8baf6fc51 100644--- a/server/tests/unit/plugins/operator-egress.test.ts+++ b/server/tests/unit/plugins/operator-egress.test.ts@@ -20,7 +20,6 @@ vi.mock('../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {}, canAccessTrip: async () => null };});import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'x'.repeat(40), ENCRYPTION_KEY: 'a'.repeat(64), updateJwtSecret: () => {} }));import { PluginRuntimeService } from '../../../src/nest/plugins/plugin-runtime.service';import { createPluginRuntime } from '../../helpers/plugin-host';diff --git a/server/tests/unit/plugins/plugin-instance-settings.test.ts b/server/tests/unit/plugins/plugin-instance-settings.test.tsindex 75cbc403a..a26da7dc6 100644--- a/server/tests/unit/plugins/plugin-instance-settings.test.ts+++ b/server/tests/unit/plugins/plugin-instance-settings.test.ts@@ -19,7 +19,6 @@ vi.mock('../../../src/db/database', async () => {return { db, closeDb: () => {}, reinitialize: () => {}, canAccessTrip: async () => null };});import { db as testDb } from '../../../src/db/database';-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'x'.repeat(40), ENCRYPTION_KEY: 'a'.repeat(64), updateJwtSecret: () => {} }));import { PluginsService } from '../../../src/nest/plugins/plugins.service';import { PluginsController } from '../../../src/nest/plugins/plugins.controller';diff --git a/server/tests/unit/plugins/settings-isolation.test.ts b/server/tests/unit/plugins/settings-isolation.test.tsindex 0eb9918c0..ff4b9619b 100644--- a/server/tests/unit/plugins/settings-isolation.test.ts+++ b/server/tests/unit/plugins/settings-isolation.test.ts@@ -20,7 +20,6 @@ import { db as testDb } from '../../../src/db/database';import { UnitOfWork } from '../../../src/nest/database/unit-of-work';import { AuditService } from '../../../src/nest/audit/audit.service';import { createTestAddonsService } from '../../helpers/test-addons';-vi.mock('../../../src/config', () => ({ JWT_SECRET: 'x'.repeat(40), ENCRYPTION_KEY: 'a'.repeat(64), updateJwtSecret: () => {} }));import { createUser } from '../../helpers/factories';import { PluginUserSettingsService } from '../../../src/nest/plugins/plugin-user-settings.service';diff --git a/server/tests/unit/services/apiKeyCrypto.test.ts b/server/tests/unit/services/apiKeyCrypto.test.tsindex 0435f772f..b27732ca6 100644--- a/server/tests/unit/services/apiKeyCrypto.test.ts+++ b/server/tests/unit/services/apiKeyCrypto.test.ts@@ -1,11 +1,4 @@-import { describe, it, expect, vi } from 'vitest';--// Inline factory to avoid vi.mock hoisting issue (no imported vars allowed)-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));+import { describe, it, expect } from 'vitest';import {encrypt_api_key,diff --git a/server/tests/unit/services/conflictUpdate.test.ts b/server/tests/unit/services/conflictUpdate.test.tsindex 483d06985..25fa07d96 100644--- a/server/tests/unit/services/conflictUpdate.test.ts+++ b/server/tests/unit/services/conflictUpdate.test.ts@@ -16,11 +16,6 @@ vi.mock('../../../src/db/database', async () => {isOwner: async () => false,};});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));import { db as testDb } from '../../../src/db/database';import { resetTestDb } from '../../helpers/test-db';diff --git a/server/tests/unit/services/mfaCrypto.test.ts b/server/tests/unit/services/mfaCrypto.test.tsindex a19dedc8b..74fadaf8e 100644--- a/server/tests/unit/services/mfaCrypto.test.ts+++ b/server/tests/unit/services/mfaCrypto.test.ts@@ -1,11 +1,4 @@-import { describe, it, expect, vi } from 'vitest';--// Inline factory to avoid vi.mock hoisting issue (no imported vars allowed)-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));+import { describe, it, expect } from 'vitest';import { encryptMfaSecret, decryptMfaSecret } from '../../../src/nest/common/crypto/mfaCrypto';diff --git a/server/tests/unit/services/trekPhotoMedia.test.ts b/server/tests/unit/services/trekPhotoMedia.test.tsindex 665c3ebee..651f20856 100644--- a/server/tests/unit/services/trekPhotoMedia.test.ts+++ b/server/tests/unit/services/trekPhotoMedia.test.ts@@ -11,11 +11,6 @@ vi.mock('../../../src/db/database', async () => {db.exec('PRAGMA foreign_keys = OFF');return { db, closeDb: () => {}, reinitialize: () => {}, getPlaceWithTags: async () => null, canAccessTrip: async () => null, isOwner: async () => false };});-vi.mock('../../../src/config', () => ({- JWT_SECRET: 'test-secret',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},-}));import { db as testDb } from '../../../src/db/database';import { createUser } from '../../helpers/factories';diff --git a/server/tests/websocket/connection.test.ts b/server/tests/websocket/connection.test.tsindex 2a6c34b7d..b1de596ae 100644--- a/server/tests/websocket/connection.test.ts+++ b/server/tests/websocket/connection.test.ts@@ -10,21 +10,12 @@ import net from 'node:net';import crypto from 'node:crypto';import request from 'supertest';import WebSocket from 'ws';-import { broadcastToUser, getOnlineUserIds } from '../../src/websocket';+import { broadcastToUser, getOnlineUserIds } from '../../src/nest/realtime/ws-state';vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));import type { INestApplication } from '@nestjs/common';import { buildApp, getHttpServer } from '../../src/bootstrap';diff --git a/server/tests/websocket/wire-envelope.test.ts b/server/tests/websocket/wire-envelope.test.tsindex 1cc40c630..e4159c773 100644--- a/server/tests/websocket/wire-envelope.test.ts+++ b/server/tests/websocket/wire-envelope.test.ts@@ -12,7 +12,7 @@* every client would receive its own writes back and drag-and-drop would jump.** None of that shows up in the existing suite, because the 100+ tests that touch- * realtime mock `src/websocket` and never look at the bytes. So: if a change makes+ * realtime record broadcasts on a FakeRealtimeService and never look at the bytes. So: if a change makes* these fail, it is a breaking change for every deployed client.*/import { describe, it, expect, vi, beforeAll, afterAll, beforeEach } from 'vitest';@@ -23,22 +23,13 @@ vi.mock('../../src/db/database', async () => {const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');return buildDbMock(createSnapshotTestDb());});-vi.mock('../../src/config', () => ({- JWT_SECRET: 'test-jwt-secret-for-trek-testing-only',- ENCRYPTION_KEY: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2a3b4c5d6a7b8c9d0e1f2',- updateJwtSecret: () => {},- SESSION_DURATION: '24h',- SESSION_DURATION_MS: 86400000,- SESSION_DURATION_SECONDS: 86400,- DEFAULT_LANGUAGE: 'en',-}));import type { INestApplication } from '@nestjs/common';import { buildApp, getHttpServer } from '../../src/bootstrap';import { db as testDb } from '../../src/db/database';import { resetTestDb } from '../helpers/test-db';import { createUser, createTrip } from '../helpers/factories';-import { broadcast, broadcastToUser } from '../../src/websocket';+import { broadcast, broadcastToUser } from '../../src/nest/realtime/ws-state';import { createEphemeralToken } from '../../src/nest/auth-core/ephemeral-tokens';let server: http.Server;