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(db): run the Immich, Synology and unified memories suites on the real database module
Mauricef11f021e1536
diff --git a/server/scripts/test-mocks-baseline.json b/server/scripts/test-mocks-baseline.jsonindex 67ee7cb8d..f2716c2b7 100644--- a/server/scripts/test-mocks-baseline.json+++ b/server/scripts/test-mocks-baseline.json@@ -58,9 +58,6 @@"tests/integration/legacy-upgrade-v205.test.ts": 1,"tests/integration/legacy-upgrade-v242.test.ts": 1,"tests/integration/legacy-upgrade-v244.test.ts": 1,- "tests/integration/memories-immich.test.ts": 1,- "tests/integration/memories-synology.test.ts": 1,- "tests/integration/memories-unified.test.ts": 1,"tests/integration/plugins/boot-registry-order.test.ts": 1,"tests/integration/plugins/plugin-runtime.test.ts": 1,"tests/integration/scheduler-gate.test.ts": 1,diff --git a/server/tests/integration/memories-immich.test.ts b/server/tests/integration/memories-immich.test.tsindex bb223b015..2293836b4 100644--- a/server/tests/integration/memories-immich.test.ts+++ b/server/tests/integration/memories-immich.test.ts@@ -6,26 +6,24 @@* safeFetch is mocked to return fake Immich API responses based on URL patterns.* No real HTTP calls are made.*/+import { readEnv } from '../../src/app-config';import { buildApp } from '../../src/bootstrap';-import { db as testDb } from '../../src/db/database';+import { postgresTarget } from '../../src/db/engine';import { PhotoProviders } from '../../src/db/entities/PhotoProviders.entity';import { TrekPhotos } from '../../src/db/entities/TrekPhotos.entity';import { TripPhotos } from '../../src/db/entities/TripPhotos.entity';import { Users } from '../../src/db/entities/Users.entity';import { safeFetch } from '../../src/utils/ssrfGuard';import { authCookie } from '../helpers/auth';-import {- createUser,- createTrip,- addTripMember,- addTripPhoto,- addAlbumLink,- setImmichCredentials,-} from '../helpers/factories';import type { FactoryOrm } from '../helpers/factories/context';+import { addAlbumLink, addTripPhoto } from '../helpers/factories/photos';import { findRow, findRows, insertRow, updateRows } from '../helpers/factories/rows';+import { setAddonEnabled } from '../helpers/factories/settings';+import { addTripMember, makeTrip } from '../helpers/factories/trips';+import { makeUser, setImmichCredentials } from '../helpers/factories/users';import { readUser } from '../helpers/factories/users';-import { resetTestDb, resetRateLimits, setAddonEnabled } from '../helpers/test-db';+import { resetDatabase } from '../helpers/reset-database';+import { resetRateLimits } from '../helpers/test-db';import { MikroORM } from '@mikro-orm/core';import type { INestApplication } from '@nestjs/common';@@ -69,11 +67,6 @@ const DEFAULT_ALBUM_ASSETS = [{ id: 'asset-legacy-hidden', type: 'VIDEO', fileCreatedAt: '2024-06-04T10:00:00.000Z', isVisible: false },];-vi.mock('../../src/db/database', async () => {- const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');- return buildDbMock(createSnapshotTestDb());-});-// ── SSRF guard mock — routes all Immich API calls to fake responses ───────────vi.mock('../../src/utils/ssrfGuard', async () => {const actual = await vi.importActual<typeof import('../../src/utils/ssrfGuard')>('../../src/utils/ssrfGuard');@@ -260,6 +253,9 @@ vi.mock('../../src/utils/ssrfGuard', async () => {};});+/** The lane runs this file on Postgres when TREK_DB_URL names one (vitest.pg.config.ts). */+const ON_POSTGRES = postgresTarget(readEnv().db) !== null;+let nestApp: INestApplication;let app: Application;let orm: FactoryOrm;@@ -288,10 +284,10 @@ beforeAll(async () => {});beforeEach(async () => {- resetTestDb(testDb);+ await resetDatabase(orm);await resetRateLimits(nestApp);// Providers only count as enabled under an enabled journey addon (migration 84 seeds it off).- setAddonEnabled(testDb, 'journey', true);+ await setAddonEnabled(orm, 'journey', true);// The migrated snapshot seeds photo_providers.immich.enabled = 0 (an admin must// configure it before it's usable in production); the legacy test helper always// seeded it enabled, which is what these tests assume. Same convention@@ -305,14 +301,13 @@ beforeEach(async () => {afterAll(async () => {await nestApp.close();- testDb.close();});// ── Connection status ─────────────────────────────────────────────────────────describe('Immich connection status', () => {it('IMMICH-030 — GET /status when not configured returns { connected: false }', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).get(`${IMMICH}/status`).set('Cookie', authCookie(user.id));@@ -321,8 +316,8 @@ describe('Immich connection status', () => {});it('IMMICH-031 — GET /status when configured returns connected + user info', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');const res = await request(app).get(`${IMMICH}/status`).set('Cookie', authCookie(user.id));@@ -336,7 +331,7 @@ describe('Immich connection status', () => {describe('Immich test connection', () => {it('IMMICH-032 — POST /test with missing fields returns { connected: false }', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).post(`${IMMICH}/test`)@@ -348,7 +343,7 @@ describe('Immich test connection', () => {});it('IMMICH-033 — POST /test with valid credentials returns { connected: true }', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).post(`${IMMICH}/test`)@@ -365,7 +360,7 @@ describe('Immich test connection', () => {describe('Immich browse and search', () => {it('IMMICH-040 — GET /browse when not configured returns 400', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).get(`${IMMICH}/browse`).set('Cookie', authCookie(user.id));@@ -373,8 +368,8 @@ describe('Immich browse and search', () => {});it('IMMICH-041 — GET /browse returns timeline buckets', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');const res = await request(app).get(`${IMMICH}/browse`).set('Cookie', authCookie(user.id));@@ -384,8 +379,8 @@ describe('Immich browse and search', () => {});it('IMMICH-042 — POST /search returns mapped assets with hasMore flag', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');const res = await request(app).post(`${IMMICH}/search`)@@ -406,8 +401,8 @@ describe('Immich browse and search', () => {});it('IMMICH-043 — POST /search when upstream throws returns 502', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');vi.mocked(safeFetch).mockRejectedValueOnce(new Error('upstream unreachable'));@@ -422,10 +417,10 @@ describe('Immich browse and search', () => {describe('Immich asset proxy', () => {it('IMMICH-050 — GET /assets/info returns asset metadata for own photo', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');- addTripPhoto(testDb, trip.id, user.id, 'asset-info-1', 'immich', { shared: false });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');+ await addTripPhoto(orm, trip.id, user.id, 'asset-info-1', 'immich', { shared: false });const res = await request(app).get(`${IMMICH}/assets/${trip.id}/asset-info-1/${user.id}/info`)@@ -436,8 +431,8 @@ describe('Immich asset proxy', () => {});it('IMMICH-051 — GET /assets/info with invalid assetId (special chars) returns 400', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);// ID contains characters outside [a-zA-Z0-9_-] → fails isValidAssetId()const invalidId = 'asset!@#$%';@@ -449,13 +444,13 @@ describe('Immich asset proxy', () => {});it('IMMICH-052 — GET /assets/info by non-owner of unshared photo returns 403', async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, member.id);- setImmichCredentials(testDb, owner.id, 'https://immich.example.com', 'test-api-key');+ const { user: owner } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, member.id);+ await setImmichCredentials(orm, owner.id, 'https://immich.example.com', 'test-api-key');// private photo — shared = false- addTripPhoto(testDb, trip.id, owner.id, 'asset-private', 'immich', { shared: false });+ await addTripPhoto(orm, trip.id, owner.id, 'asset-private', 'immich', { shared: false });const res = await request(app).get(`${IMMICH}/assets/${trip.id}/asset-private/${owner.id}/info`)@@ -465,13 +460,13 @@ describe('Immich asset proxy', () => {});it('IMMICH-053 — GET /assets/info by trip member for shared photo returns 200', async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, member.id);- setImmichCredentials(testDb, owner.id, 'https://immich.example.com', 'test-api-key');+ const { user: owner } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, member.id);+ await setImmichCredentials(orm, owner.id, 'https://immich.example.com', 'test-api-key');// shared photo- addTripPhoto(testDb, trip.id, owner.id, 'asset-shared', 'immich', { shared: true });+ await addTripPhoto(orm, trip.id, owner.id, 'asset-shared', 'immich', { shared: true });const res = await request(app).get(`${IMMICH}/assets/${trip.id}/asset-shared/${owner.id}/info`)@@ -481,10 +476,10 @@ describe('Immich asset proxy', () => {});it('IMMICH-054 — GET /assets/thumbnail for own photo streams image data', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');- addTripPhoto(testDb, trip.id, user.id, 'asset-thumb', 'immich', { shared: false });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');+ await addTripPhoto(orm, trip.id, user.id, 'asset-thumb', 'immich', { shared: false });const res = await request(app).get(`${IMMICH}/assets/${trip.id}/asset-thumb/${user.id}/thumbnail`)@@ -496,11 +491,11 @@ describe('Immich asset proxy', () => {});it("IMMICH-055 — GET /assets/thumbnail for other's unshared photo returns 403", async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, member.id);- addTripPhoto(testDb, trip.id, owner.id, 'asset-noshare', 'immich', { shared: false });+ const { user: owner } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, member.id);+ await addTripPhoto(orm, trip.id, owner.id, 'asset-noshare', 'immich', { shared: false });const res = await request(app).get(`${IMMICH}/assets/${trip.id}/asset-noshare/${owner.id}/thumbnail`)@@ -510,12 +505,12 @@ describe('Immich asset proxy', () => {});it('IMMICH-056 — GET /assets/original for shared photo streams image data', async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, member.id);- setImmichCredentials(testDb, owner.id, 'https://immich.example.com', 'test-api-key');- addTripPhoto(testDb, trip.id, owner.id, 'asset-orig', 'immich', { shared: true });+ const { user: owner } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, member.id);+ await setImmichCredentials(orm, owner.id, 'https://immich.example.com', 'test-api-key');+ await addTripPhoto(orm, trip.id, owner.id, 'asset-orig', 'immich', { shared: true });const res = await request(app).get(`${IMMICH}/assets/${trip.id}/asset-orig/${owner.id}/original`)@@ -525,17 +520,21 @@ describe('Immich asset proxy', () => {expect(res.headers['content-type']).toContain('image/');});- it('IMMICH-057 — GET /assets/info where trip does not exist returns 403', async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);+ // A shared photo row whose trip is gone: the foreign key's cascade makes that+ // impossible on a database that enforces it, so the row is written with+ // SQLite's foreign keys off, which Postgres has no equivalent of.+ it.skipIf(ON_POSTGRES)('IMMICH-057 — GET /assets/info where trip does not exist returns 403', async () => {+ const { user: owner } = await makeUser(orm);+ const { user: member } = await makeUser(orm);// Insert a shared photo referencing a trip that doesn't exist (FK disabled temporarily)- testDb.exec('PRAGMA foreign_keys = OFF');+ // test-sql-allow: the orphaned row this case needs exists only with SQLite's foreign keys switched off.+ await orm.em.getConnection().execute('PRAGMA foreign_keys = OFF');const known = await findRow(orm, TrekPhotos, { provider: 'immich', asset_id: 'asset-notrip', owner: owner.id });const photoId =known?.id ??(await insertRow(orm, TrekPhotos, { provider: 'immich', asset_id: 'asset-notrip', owner: owner.id }));await insertRow(orm, TripPhotos, { trip: 9999, user: owner.id, photo: photoId, shared: 1 });- testDb.exec('PRAGMA foreign_keys = ON');+ await orm.em.getConnection().execute('PRAGMA foreign_keys = ON');const res = await request(app).get(`${IMMICH}/assets/9999/asset-notrip/${owner.id}/info`)@@ -546,10 +545,10 @@ describe('Immich asset proxy', () => {});it('IMMICH-058 — GET /assets/info when upstream returns error propagates status', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');- addTripPhoto(testDb, trip.id, user.id, 'asset-upstream-err', 'immich', { shared: false });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');+ await addTripPhoto(orm, trip.id, user.id, 'asset-upstream-err', 'immich', { shared: false });vi.mocked(safeFetch).mockResolvedValueOnce({ok: false,@@ -571,7 +570,7 @@ describe('Immich asset proxy', () => {describe('Immich albums', () => {it('IMMICH-060 — GET /albums when not configured returns 400', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).get(`${IMMICH}/albums`).set('Cookie', authCookie(user.id));@@ -579,8 +578,8 @@ describe('Immich albums', () => {});it('IMMICH-061 — GET /albums returns album list', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');const res = await request(app).get(`${IMMICH}/albums`).set('Cookie', authCookie(user.id));@@ -594,8 +593,8 @@ describe('Immich albums', () => {describe('Immich album photos', () => {it('IMMICH-062 — GET /albums/:id/photos returns photos even though the album detail body has no `assets` (Immich v3)', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');const res = await request(app).get(`${IMMICH}/albums/album-uuid-1/photos`).set('Cookie', authCookie(user.id));@@ -606,8 +605,8 @@ describe('Immich album photos', () => {});it('IMMICH-063 — GET /albums/:id/photos filters hidden assets (both visibility and legacy isVisible markers)', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');const res = await request(app).get(`${IMMICH}/albums/album-uuid-1/photos`).set('Cookie', authCookie(user.id));@@ -617,8 +616,8 @@ describe('Immich album photos', () => {});it('IMMICH-064 — GET /albums/:id/photos maps exif and media type', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');const res = await request(app).get(`${IMMICH}/albums/album-uuid-1/photos`).set('Cookie', authCookie(user.id));@@ -638,8 +637,8 @@ describe('Immich album photos', () => {// #1614 — the album mapping used to drop lat/lng even though the search path// kept them, so a photo picked from an album could never reach a map.it('IMMICH-064b — album photos carry their capture coordinates, and tolerate their absence', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');const res = await request(app).get(`${IMMICH}/albums/album-uuid-1/photos`).set('Cookie', authCookie(user.id));@@ -652,8 +651,8 @@ describe('Immich album photos', () => {});it('IMMICH-065 — album photos are fetched via search/metadata with albumIds and withExif', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');await request(app).get(`${IMMICH}/albums/album-uuid-1/photos`).set('Cookie', authCookie(user.id));@@ -671,8 +670,8 @@ describe('Immich album photos', () => {});it('IMMICH-066 — GET /albums/:id/photos pages through albums larger than one page', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');// Page 1 is exactly `size` long, so the service must ask for page 2.const pageOne = Array.from({ length: 1000 }, (_, i) => ({@@ -698,8 +697,8 @@ describe('Immich album photos', () => {// v2's searchMetadata unconditionally scopes to `[self, ...partners]`, so an// albumIds search there returns nothing for an album shared by a non-partner.it('IMMICH-069a — on Immich v2 album photos come from the album detail body, with no search call', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');immichState.albumDetailHasAssets = true;const res = await request(app).get(`${IMMICH}/albums/album-uuid-1/photos`).set('Cookie', authCookie(user.id));@@ -710,8 +709,8 @@ describe('Immich album photos', () => {});it('IMMICH-069b — on Immich v2 an empty album stays empty and does not fall back to search', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');immichState.albumDetailHasAssets = true;immichState.albumAssets = [];@@ -723,10 +722,10 @@ describe('Immich album photos', () => {});it('IMMICH-069c — on Immich v2 sync reads the album detail body', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');- const link = addAlbumLink(testDb, trip.id, user.id, 'immich', 'album-uuid-1', 'Vacation 2024');+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');+ const link = await addAlbumLink(orm, trip.id, user.id, 'immich', 'album-uuid-1', 'Vacation 2024');immichState.albumDetailHasAssets = true;const res = await request(app)@@ -739,7 +738,7 @@ describe('Immich album photos', () => {});it('IMMICH-067 — GET /albums/:id/photos when not configured returns 400', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).get(`${IMMICH}/albums/album-uuid-1/photos`).set('Cookie', authCookie(user.id));@@ -747,8 +746,8 @@ describe('Immich album photos', () => {});it('IMMICH-068 — GET /albums/:id/photos when Immich is unreachable returns 502', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');vi.mocked(safeFetch).mockRejectedValueOnce(new Error('network failure'));@@ -798,10 +797,10 @@ describe('Immich auth checks', () => {describe('Immich syncAlbumAssets', () => {it('IMMICH-080 — POST sync happy path: trip owner with album link saves photos to DB', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');- const link = addAlbumLink(testDb, trip.id, user.id, 'immich', 'album-uuid-1', 'Vacation 2024');+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');+ const link = await addAlbumLink(orm, trip.id, user.id, 'immich', 'album-uuid-1', 'Vacation 2024');const res = await request(app).post(`${IMMICH}/trips/${trip.id}/album-links/${link.id}/sync`)@@ -821,10 +820,10 @@ describe('Immich syncAlbumAssets', () => {});it('IMMICH-087 — POST sync does not persist hidden assets (#1474)', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');- const link = addAlbumLink(testDb, trip.id, user.id, 'immich', 'album-uuid-1', 'Vacation 2024');+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');+ const link = await addAlbumLink(orm, trip.id, user.id, 'immich', 'album-uuid-1', 'Vacation 2024');// A hidden IMAGE slips past the `type === 'IMAGE'` filter. Persisting it// yields a permanently broken tile: nothing re-checks visibility on the@@ -847,10 +846,10 @@ describe('Immich syncAlbumAssets', () => {});it('IMMICH-086 — POST sync fetches album contents via search/metadata with albumIds', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');- const link = addAlbumLink(testDb, trip.id, user.id, 'immich', 'album-uuid-1', 'Vacation 2024');+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');+ const link = await addAlbumLink(orm, trip.id, user.id, 'immich', 'album-uuid-1', 'Vacation 2024');await request(app).post(`${IMMICH}/trips/${trip.id}/album-links/${link.id}/sync`)@@ -860,11 +859,11 @@ describe('Immich syncAlbumAssets', () => {});it('IMMICH-081 — POST sync when user is not a trip member returns 404', async () => {- const { user: owner } = createUser(testDb);- const { user: outsider } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- setImmichCredentials(testDb, owner.id, 'https://immich.example.com', 'test-api-key');- const link = addAlbumLink(testDb, trip.id, owner.id, 'immich', 'album-uuid-1', 'Vacation 2024');+ const { user: owner } = await makeUser(orm);+ const { user: outsider } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await setImmichCredentials(orm, owner.id, 'https://immich.example.com', 'test-api-key');+ const link = await addAlbumLink(orm, trip.id, owner.id, 'immich', 'album-uuid-1', 'Vacation 2024');// outsider is not a trip member — getAlbumIdFromLink checks canAccessTripconst res = await request(app)@@ -875,10 +874,10 @@ describe('Immich syncAlbumAssets', () => {});it('IMMICH-082 — POST sync when Immich is not configured returns 400', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);// No Immich credentials set — but still need a valid album link owned by user- const link = addAlbumLink(testDb, trip.id, user.id, 'immich', 'album-uuid-1', 'Vacation 2024');+ const link = await addAlbumLink(orm, trip.id, user.id, 'immich', 'album-uuid-1', 'Vacation 2024');const res = await request(app).post(`${IMMICH}/trips/${trip.id}/album-links/${link.id}/sync`)@@ -889,10 +888,10 @@ describe('Immich syncAlbumAssets', () => {});it('IMMICH-083 — POST sync when safeFetch throws returns 502', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');- const link = addAlbumLink(testDb, trip.id, user.id, 'immich', 'album-uuid-1', 'Vacation 2024');+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');+ const link = await addAlbumLink(orm, trip.id, user.id, 'immich', 'album-uuid-1', 'Vacation 2024');vi.mocked(safeFetch).mockRejectedValueOnce(new Error('network failure during sync'));@@ -905,13 +904,13 @@ describe('Immich syncAlbumAssets', () => {});it('IMMICH-084 — POST sync when album link does not belong to requesting user returns 404', async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, member.id);- setImmichCredentials(testDb, member.id, 'https://immich.example.com', 'test-api-key');+ const { user: owner } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, member.id);+ await setImmichCredentials(orm, member.id, 'https://immich.example.com', 'test-api-key');// Album link is owned by owner, not member- const link = addAlbumLink(testDb, trip.id, owner.id, 'immich', 'album-uuid-1', 'Vacation 2024');+ const link = await addAlbumLink(orm, trip.id, owner.id, 'immich', 'album-uuid-1', 'Vacation 2024');// member is a trip member but the album link belongs to owner — getAlbumIdFromLink checks user_idconst res = await request(app)@@ -930,8 +929,8 @@ describe('Immich syncAlbumAssets', () => {describe('Immich searchPhotos pagination pass-through', () => {it('IMMICH-090 — POST /search proxies client page param and returns hasMore', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');// Return a full page so hasMore=true (items.length >= size)const fullPageResponse = {@@ -972,8 +971,8 @@ describe('Immich searchPhotos pagination pass-through', () => {});it('IMMICH-091 — POST /search returns hasMore=false on last page', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');// Partial page → hasMore=falseconst partialPageResponse = {@@ -1006,8 +1005,8 @@ describe('Immich searchPhotos pagination pass-through', () => {});it('IMMICH-094: POST /search reaches a date-filtered page past the twentieth at the picker page size (#1587)', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');// Every raw page is 200 photos of the searched day, so answered page 21// needs raw pages 1 to 21. The old flat budget of 20 answered it empty with@@ -1056,8 +1055,8 @@ describe('Immich searchPhotos pagination pass-through', () => {});it('IMMICH-093 — POST /search requests timeline visibility so Immich v3 never returns hidden assets (#1474)', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');// A sibling test installs a permanent mockResolvedValue on safeFetch, so// assert on the spy's recorded call rather than immichState.searchCalls.@@ -1084,8 +1083,8 @@ describe('Immich searchPhotos pagination pass-through', () => {});it('IMMICH-092 — POST /search filters hidden Live Photo motion assets (#1474)', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');// A Live Photo pair (visible still + hidden motion video) plus a legacy// hidden asset — only the still should survive, but hasMore reflects the@@ -1136,8 +1135,8 @@ describe('Immich searchPhotos pagination pass-through', () => {describe('Immich saveImmichSettings clearing URL', () => {it('IMMICH-095 — PUT /settings with no URL clears immich_url but preserves (updates) api key', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'old-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'old-key');// Send without immich_url to trigger the else branch (clear URL path)const res = await request(app)@@ -1152,8 +1151,8 @@ describe('Immich saveImmichSettings clearing URL', () => {});it('IMMICH-096 — PUT /settings with empty string URL clears immich_url', async () => {- const { user } = createUser(testDb);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'old-key');+ const { user } = await makeUser(orm);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'old-key');const res = await request(app).put(`${IMMICH}/settings`)@@ -1171,7 +1170,7 @@ describe('Immich saveImmichSettings clearing URL', () => {describe('Immich testConnection canonical URL detection', () => {it('IMMICH-100 — POST /test with http URL that gets upgraded to https returns canonicalUrl', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);// Mock safeFetch so the response.url reflects https upgradevi.mocked(safeFetch).mockResolvedValueOnce({@@ -1194,7 +1193,7 @@ describe('Immich testConnection canonical URL detection', () => {});it('IMMICH-101 — POST /test with https URL that stays https does not return canonicalUrl', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);// The default mock returns a response without .url property — no upgradeconst res = await request(app)@@ -1239,7 +1238,7 @@ describe('Immich self-signed certificate switch (#2475)', () => {});it('IMMICH-102: PUT /settings stores the switch and GET /settings reports it', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const put = await request(app).put(`${IMMICH}/settings`)@@ -1253,7 +1252,7 @@ describe('Immich self-signed certificate switch (#2475)', () => {});it('IMMICH-103: a save without the switch keeps it for the same server, a new server or disconnecting clears it', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const put = (body: Record<string, unknown>) =>request(app).put(`${IMMICH}/settings`).set('Cookie', authCookie(user.id)).send(body);@@ -1275,10 +1274,10 @@ describe('Immich self-signed certificate switch (#2475)', () => {});it('IMMICH-104: browse, search and the thumbnail proxy follow the stored switch', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- setImmichCredentials(testDb, user.id, 'https://immich.example.com', 'test-api-key');- addTripPhoto(testDb, trip.id, user.id, 'asset-tls', 'immich', { shared: false });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await setImmichCredentials(orm, user.id, 'https://immich.example.com', 'test-api-key');+ await addTripPhoto(orm, trip.id, user.id, 'asset-tls', 'immich', { shared: false });const cookie = authCookie(user.id);const hitEveryPath = async () => {@@ -1305,7 +1304,7 @@ describe('Immich self-signed certificate switch (#2475)', () => {});it('IMMICH-105: POST /test probes with the switch in the form, and refuses a value that is not a boolean', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const test = (allow_insecure_tls: unknown) =>request(app).post(`${IMMICH}/test`)diff --git a/server/tests/integration/memories-synology.test.ts b/server/tests/integration/memories-synology.test.tsindex 495b355d6..0c5614b1f 100644--- a/server/tests/integration/memories-synology.test.ts+++ b/server/tests/integration/memories-synology.test.ts@@ -8,8 +8,9 @@** No real HTTP calls are made.*/+import { readEnv } from '../../src/app-config';import { buildApp } from '../../src/bootstrap';-import { db as testDb } from '../../src/db/database';+import { postgresTarget } from '../../src/db/engine';import { PhotoProviders } from '../../src/db/entities/PhotoProviders.entity';import { TrekPhotos } from '../../src/db/entities/TrekPhotos.entity';import { TripAlbumLinks } from '../../src/db/entities/TripAlbumLinks.entity';@@ -23,11 +24,10 @@ import { withRequestContext } from '../../src/nest/database/request-context';import { TrekPhotoRegistrationService } from '../../src/nest/photos/trek-photo-registration.service';import { safeFetch } from '../../src/utils/ssrfGuard';import { authCookie } from '../helpers/auth';-import { createUser, createTrip, addTripMember, addTripPhoto, setSynologyCredentials } from '../helpers/factories';// ── Album sync ────────────────────────────────────────────────────────────────-import { addAlbumLink } from '../helpers/factories';import type { FactoryOrm } from '../helpers/factories/context';+import { addAlbumLink, addTripPhoto } from '../helpers/factories/photos';import {createRow,deleteRows,@@ -37,8 +37,12 @@ import {insertRowIgnoringConflict,updateRows,} from '../helpers/factories/rows';+import { setAddonEnabled } from '../helpers/factories/settings';+import { addTripMember, makeTrip } from '../helpers/factories/trips';+import { makeUser, setSynologyCredentials } from '../helpers/factories/users';import { readUser } from '../helpers/factories/users';-import { resetTestDb, resetRateLimits, setAddonEnabled } from '../helpers/test-db';+import { resetDatabase } from '../helpers/reset-database';+import { resetRateLimits } from '../helpers/test-db';import { MikroORM } from '@mikro-orm/core';import type { INestApplication } from '@nestjs/common';@@ -48,11 +52,6 @@ import { describe, it, expect, vi, beforeAll, beforeEach, afterAll, afterEach }// ── Hoisted DB mock ──────────────────────────────────────────────────────────-vi.mock('../../src/db/database', async () => {- const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');- return buildDbMock(createSnapshotTestDb());-});-// ── SSRF guard mock — routes all Synology API calls to fake responses ─────────vi.mock('../../src/utils/ssrfGuard', async () => {const actual = await vi.importActual<typeof import('../../src/utils/ssrfGuard')>('../../src/utils/ssrfGuard');@@ -220,6 +219,9 @@ vi.mock('../../src/utils/ssrfGuard', async () => {};});+/** The lane runs this file on Postgres when TREK_DB_URL names one (vitest.pg.config.ts). */+const ON_POSTGRES = postgresTarget(readEnv().db) !== null;+let nestApp: INestApplication;let app: Application;let orm: FactoryOrm;@@ -243,20 +245,19 @@ beforeAll(async () => {});beforeEach(async () => {- resetTestDb(testDb);+ await resetDatabase(orm);await resetRateLimits(nestApp);});afterAll(async () => {await nestApp.close();- testDb.close();});// ── Settings ──────────────────────────────────────────────────────────────────describe('Synology settings', () => {it('SYNO-001 — GET /settings when not configured returns 400', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).get(`${SYNO}/settings`).set('Cookie', authCookie(user.id));@@ -264,7 +265,7 @@ describe('Synology settings', () => {});it('SYNO-002 — PUT /settings saves credentials and returns success', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).put(`${SYNO}/settings`).set('Cookie', authCookie(user.id)).send({synology_url: 'https://synology.example.com',@@ -280,7 +281,7 @@ describe('Synology settings', () => {});it('SYNO-003 — PUT /settings with SSRF-blocked URL returns 400', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).put(`${SYNO}/settings`).set('Cookie', authCookie(user.id)).send({synology_url: 'http://192.168.1.100',@@ -292,7 +293,7 @@ describe('Synology settings', () => {});it('SYNO-004 — PUT /settings without URL returns 400', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).put(`${SYNO}/settings`)@@ -307,7 +308,7 @@ describe('Synology settings', () => {describe('Synology connection', () => {it('SYNO-010 — GET /status when not configured returns { connected: false }', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).get(`${SYNO}/status`).set('Cookie', authCookie(user.id));@@ -316,8 +317,8 @@ describe('Synology connection', () => {});it('SYNO-011 — GET /status when configured returns { connected: true }', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');const res = await request(app).get(`${SYNO}/status`).set('Cookie', authCookie(user.id));@@ -326,7 +327,7 @@ describe('Synology connection', () => {});it('SYNO-012 — POST /test with valid credentials returns { connected: true }', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).post(`${SYNO}/test`).set('Cookie', authCookie(user.id)).send({synology_url: 'https://synology.example.com',@@ -339,7 +340,7 @@ describe('Synology connection', () => {});it('SYNO-013 — POST /test with missing fields returns error', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const res = await request(app).post(`${SYNO}/test`)@@ -356,8 +357,8 @@ describe('Synology connection', () => {describe('Synology search and albums', () => {it('SYNO-020 — POST /search returns mapped assets', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');const res = await request(app).post(`${SYNO}/search`).set('Cookie', authCookie(user.id)).send({});@@ -367,8 +368,8 @@ describe('Synology search and albums', () => {});it('SYNO-021 — POST /search when upstream throws propagates 500', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');// Auth call succeeds, search call throws a network errorvi.mocked(safeFetch)@@ -388,8 +389,8 @@ describe('Synology search and albums', () => {});it('SYNO-022 — GET /albums returns album list', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');const res = await request(app).get(`${SYNO}/albums`).set('Cookie', authCookie(user.id));@@ -414,8 +415,8 @@ describe('Synology listSynologyAlbums multi-source merge', () => {});it('SYNO-027 — personal-only: shared and shared-with-me return failure → merged result contains personal albums, no error', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');vi.mocked(safeFetch).mockImplementation((_url: string, init?: any) => {// Always read both URL params and body params; body takes precedence for request-specific fields.@@ -481,8 +482,8 @@ describe('Synology listSynologyAlbums multi-source merge', () => {});it('SYNO-028 — full merge: personal + shared (with passphrase) + shared-with-me (with sharing_info.passphrase) → 4 albums with correct passphrases', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');vi.mocked(safeFetch).mockImplementation((_url: string, init?: any) => {const urlParams = (() => {@@ -568,8 +569,8 @@ describe('Synology listSynologyAlbums multi-source merge', () => {});it('SYNO-029 — dedup: same album id=99 in personal and shared-with-me → last-write-wins gives passphrase from shared-with-me', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');vi.mocked(safeFetch).mockImplementation((_url: string, init?: any) => {const urlParams = (() => {@@ -645,10 +646,10 @@ describe('Synology listSynologyAlbums multi-source merge', () => {describe('Synology asset access', () => {it('SYNO-030 — GET /assets/info returns metadata for own photo', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');- addTripPhoto(testDb, trip.id, user.id, '101_cachekey', 'synologyphotos', { shared: false });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');+ await addTripPhoto(orm, trip.id, user.id, '101_cachekey', 'synologyphotos', { shared: false });const res = await request(app).get(`${SYNO}/assets/${trip.id}/101_cachekey/${user.id}/info`)@@ -659,11 +660,11 @@ describe('Synology asset access', () => {});it('SYNO-031 — GET /assets/info by non-owner of unshared photo returns 403', async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, member.id);- addTripPhoto(testDb, trip.id, owner.id, '101_cachekey', 'synologyphotos', { shared: false });+ const { user: owner } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, member.id);+ await addTripPhoto(orm, trip.id, owner.id, '101_cachekey', 'synologyphotos', { shared: false });const res = await request(app).get(`${SYNO}/assets/${trip.id}/101_cachekey/${owner.id}/info`)@@ -673,10 +674,10 @@ describe('Synology asset access', () => {});it('SYNO-032 — GET /assets/thumbnail streams image data for own photo', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');- addTripPhoto(testDb, trip.id, user.id, '101_cachekey', 'synologyphotos', { shared: false });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');+ await addTripPhoto(orm, trip.id, user.id, '101_cachekey', 'synologyphotos', { shared: false });const res = await request(app).get(`${SYNO}/assets/${trip.id}/101_cachekey/${user.id}/thumbnail`)@@ -687,8 +688,8 @@ describe('Synology asset access', () => {});it('SYNO-032b — GET /api/photos/:id/thumbnail uses an allowed Synology thumbnail size', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');const trekPhotoId = await insertRow(orm, TrekPhotos, {provider: 'synologyphotos',@@ -704,12 +705,12 @@ describe('Synology asset access', () => {});it('SYNO-033 — GET /assets/original streams image data for shared photo', async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, member.id);- setSynologyCredentials(testDb, owner.id, 'https://synology.example.com', 'admin', 'pass');- addTripPhoto(testDb, trip.id, owner.id, '101_cachekey', 'synologyphotos', { shared: true });+ const { user: owner } = await makeUser(orm);+ const { user: member } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await addTripMember(orm, trip.id, member.id);+ await setSynologyCredentials(orm, owner.id, 'https://synology.example.com', 'admin', 'pass');+ await addTripPhoto(orm, trip.id, owner.id, '101_cachekey', 'synologyphotos', { shared: true });const res = await request(app).get(`${SYNO}/assets/${trip.id}/101_cachekey/${owner.id}/original`)@@ -720,9 +721,9 @@ describe('Synology asset access', () => {});it('SYNO-034 — GET /assets with invalid kind returns 400', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- addTripPhoto(testDb, trip.id, user.id, '101_cachekey', 'synologyphotos', { shared: false });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await addTripPhoto(orm, trip.id, user.id, '101_cachekey', 'synologyphotos', { shared: false });const res = await request(app).get(`${SYNO}/assets/${trip.id}/101_cachekey/${user.id}/badkind`)@@ -731,11 +732,15 @@ describe('Synology asset access', () => {expect(res.status).toBe(400);});- it('SYNO-035 — GET /assets/info where trip does not exist returns 403', async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);+ // A shared photo row whose trip is gone: the foreign key's cascade makes that+ // impossible on a database that enforces it, so the row is written with+ // SQLite's foreign keys off, which Postgres has no equivalent of.+ it.skipIf(ON_POSTGRES)('SYNO-035 — GET /assets/info where trip does not exist returns 403', async () => {+ const { user: owner } = await makeUser(orm);+ const { user: member } = await makeUser(orm);// Insert a shared photo referencing a trip that doesn't exist (FK disabled temporarily)- testDb.exec('PRAGMA foreign_keys = OFF');+ // test-sql-allow: the orphaned row this case needs exists only with SQLite's foreign keys switched off.+ await orm.em.getConnection().execute('PRAGMA foreign_keys = OFF');const known = await findRow(orm, TrekPhotos, {provider: 'synologyphotos',asset_id: '101_cachekey',@@ -745,7 +750,7 @@ describe('Synology asset access', () => {known?.id ??(await insertRow(orm, TrekPhotos, { provider: 'synologyphotos', asset_id: '101_cachekey', owner: owner.id }));await insertRow(orm, TripPhotos, { trip: 9999, user: owner.id, photo: tkpSyno35, shared: 1 });- testDb.exec('PRAGMA foreign_keys = ON');+ await orm.em.getConnection().execute('PRAGMA foreign_keys = ON');const res = await request(app).get(`${SYNO}/assets/9999/101_cachekey/${owner.id}/info`)@@ -756,10 +761,10 @@ describe('Synology asset access', () => {});it('SYNO-036 — GET /assets/info when upstream throws propagates 500', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');- addTripPhoto(testDb, trip.id, user.id, '101_cachekey', 'synologyphotos', { shared: false });+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');+ await addTripPhoto(orm, trip.id, user.id, '101_cachekey', 'synologyphotos', { shared: false });// Auth call succeeds, Browse.Item call throws a network errorvi.mocked(safeFetch)@@ -819,16 +824,16 @@ describe('Synology auth checks', () => {describe('Synology syncSynologyAlbumLink', () => {it('SYNO-050 — POST sync happy path: trip owner with album link saves photos to DB', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');// The migration inserts synologyphotos with enabled=0; ensure it is enabled for this test.// A provider only counts as enabled under an enabled journey addon (also seeded off).await updateRows(orm, PhotoProviders, { id: 'synologyphotos' }, { enabled: 1 });- setAddonEnabled(testDb, 'journey', true);+ await setAddonEnabled(orm, 'journey', true);// album_id must be a numeric string so getAlbumIdFromLink returns it and// syncSynologyAlbumLink passes Number(album_id) to the API.- const link = addAlbumLink(testDb, trip.id, user.id, 'synologyphotos', '1', 'Summer Trip');+ const link = await addAlbumLink(orm, trip.id, user.id, 'synologyphotos', '1', 'Summer Trip');const res = await request(app).post(`${SYNO}/trips/${trip.id}/album-links/${link.id}/sync`)@@ -845,11 +850,11 @@ describe('Synology syncSynologyAlbumLink', () => {});it('SYNO-051 — POST sync when user is not a trip member returns 404', async () => {- const { user: owner } = createUser(testDb);- const { user: outsider } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- setSynologyCredentials(testDb, owner.id, 'https://synology.example.com', 'admin', 'pass');- const link = addAlbumLink(testDb, trip.id, owner.id, 'synologyphotos', '1', 'Summer Trip');+ const { user: owner } = await makeUser(orm);+ const { user: outsider } = await makeUser(orm);+ const trip = await makeTrip(orm, owner.id);+ await setSynologyCredentials(orm, owner.id, 'https://synology.example.com', 'admin', 'pass');+ const link = await addAlbumLink(orm, trip.id, owner.id, 'synologyphotos', '1', 'Summer Trip');const res = await request(app).post(`${SYNO}/trips/${trip.id}/album-links/${link.id}/sync`)@@ -859,10 +864,10 @@ describe('Synology syncSynologyAlbumLink', () => {});it('SYNO-052 — POST sync when Synology is not configured returns 400', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);// No credentials — album link still exists for the user- const link = addAlbumLink(testDb, trip.id, user.id, 'synologyphotos', '1', 'Summer Trip');+ const link = await addAlbumLink(orm, trip.id, user.id, 'synologyphotos', '1', 'Summer Trip');const res = await request(app).post(`${SYNO}/trips/${trip.id}/album-links/${link.id}/sync`)@@ -877,11 +882,11 @@ describe('Synology syncSynologyAlbumLink', () => {});it('SYNO-054 — POST sync with passphrase link: uses passphrase in item-list call and persists encrypted passphrase on trek_photos', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');await updateRows(orm, PhotoProviders, { id: 'synologyphotos' }, { enabled: 1 });- setAddonEnabled(testDb, 'journey', true);+ await setAddonEnabled(orm, 'journey', true);// Insert a link with an encrypted passphrase directly into the DB.const rawPassphrase = 'syno-share-pass-abc';@@ -965,8 +970,8 @@ describe('Synology syncSynologyAlbumLink', () => {describe('Synology session retry on error codes 106/107/119', () => {it('SYNO-060 — request retries with fresh session when API returns error code 119', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');// Clear previous call history so the count only reflects this test's callsvi.mocked(safeFetch).mockClear();@@ -1026,8 +1031,8 @@ describe('Synology session retry on error codes 106/107/119', () => {});it('SYNO-061 — request retries with fresh session when API returns error code 106', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');vi.mocked(safeFetch).mockClear();vi.mocked(safeFetch)@@ -1077,8 +1082,8 @@ describe('Synology session retry on error codes 106/107/119', () => {describe('Synology searchSynologyPhotos date range', () => {it('SYNO-070 — POST /search with from/to passes start_time and end_time to Synology API', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');// Capture the body sent on the search call (second safeFetch call after auth)let capturedBody: URLSearchParams | null = null;@@ -1147,8 +1152,8 @@ describe('Synology searchSynologyPhotos date range', () => {});it('SYNO-071 — POST /search without date range omits start_time and end_time', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');let capturedBody: URLSearchParams | null = null;vi.mocked(safeFetch)@@ -1184,8 +1189,8 @@ describe('Synology searchSynologyPhotos date range', () => {describe('Synology search pagination', () => {it('SYNO-025 — POST /search with { page: 2, size: 50 } sends offset=50 and limit=50 to Synology API', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');let capturedBody: URLSearchParams | null = null;vi.mocked(safeFetch)@@ -1222,8 +1227,8 @@ describe('Synology search pagination', () => {});it('SYNO-026 — POST /search with { page: 3, size: 25 } sends offset=50 and limit=25 to Synology API', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');let capturedBody: URLSearchParams | null = null;vi.mocked(safeFetch)@@ -1263,8 +1268,8 @@ describe('Synology search pagination', () => {describe('Synology SSRF blocked error handling', () => {it('SYNO-080 — safeFetch throwing SsrfBlockedError for private IP URL returns connected: false', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'http://192.168.1.200', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'http://192.168.1.200', 'admin', 'pass');const { SsrfBlockedError: SsrfErr } = await import('../../src/utils/ssrfGuard');@@ -1280,8 +1285,8 @@ describe('Synology SSRF blocked error handling', () => {});it('SYNO-081 — safeFetch throwing SsrfBlockedError during one album source is swallowed; other sources still return albums', async () => {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');const { SsrfBlockedError: SsrfErr } = await import('../../src/utils/ssrfGuard');@@ -1338,7 +1343,7 @@ const deleteTrekPhotoIfOrphan = (id: number) => withRequestContext(orm, () => trdescribe('trek_photos passphrase healing (SYNO-090)', () => {it('SYNO-090 — getOrCreateTrekPhoto overwrites an existing bad passphrase when a new one is supplied', async () => {- const { user } = createUser(testDb);+ const { user } = await makeUser(orm);const wrongPass = 'wrong-passphrase';const correctPass = 'correct-passphrase';@@ -1356,8 +1361,8 @@ describe('trek_photos passphrase healing (SYNO-090)', () => {describe('trek_photos orphan cleanup (SYNO-091)', () => {it('SYNO-091 — deleteTrekPhotoIfOrphan removes the trek_photos row when no trip_photos or journey_photos reference it', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);await updateRows(orm, PhotoProviders, { id: 'synologyphotos' }, { enabled: 1 });const trekPhotoId = await getOrCreateTrekPhoto('synologyphotos', 'asset-orphan-test', user.id, 'pass-A');@@ -1375,8 +1380,8 @@ describe('trek_photos orphan cleanup (SYNO-091)', () => {});it('SYNO-092 — re-adding a previously removed Synology photo stores the new passphrase correctly', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm);+ const trip = await makeTrip(orm, user.id);await updateRows(orm, PhotoProviders, { id: 'synologyphotos' }, { enabled: 1 });const firstPass = 'first-passphrase';@@ -1416,8 +1421,8 @@ describe('Synology skip-SSL forwarding to image fetches (#1611)', () => {const uniqueAssetId = () => `${Date.now()}${++assetSeq}_test1611`;async function createSynologyTrekPhoto(skipSsl: 0 | 1) {- const { user } = createUser(testDb);- setSynologyCredentials(testDb, user.id, 'https://synology.example.com', 'admin', 'pass');+ const { user } = await makeUser(orm);+ await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass');await updateRows(orm, Users, { id: user.id }, { synology_skip_ssl: skipSsl });const assetId = uniqueAssetId();const trekPhotoId = await insertRow(orm, TrekPhotos, {diff --git a/server/tests/integration/memories-unified.test.ts b/server/tests/integration/memories-unified.test.tsindex 2793883b9..1578cbe6d 100644--- a/server/tests/integration/memories-unified.test.ts+++ b/server/tests/integration/memories-unified.test.ts@@ -6,15 +6,18 @@* No real HTTP is made — safeFetch is mocked to never be called.*/import { buildApp } from '../../src/bootstrap';-import { db as testDb } from '../../src/db/database';import { PhotoProviders } from '../../src/db/entities/PhotoProviders.entity';import { TrekPhotos } from '../../src/db/entities/TrekPhotos.entity';import { TripPhotos } from '../../src/db/entities/TripPhotos.entity';import { authCookie } from '../helpers/auth';-import { createUser, createTrip, addTripMember, addTripPhoto, addAlbumLink } from '../helpers/factories';import type { FactoryOrm } from '../helpers/factories/context';+import { addAlbumLink, addTripPhoto } from '../helpers/factories/photos';import { findRow, findRows, updateRows } from '../helpers/factories/rows';-import { resetTestDb, resetRateLimits, setAddonEnabled } from '../helpers/test-db';+import { setAddonEnabled } from '../helpers/factories/settings';+import { addTripMember, makeTrip } from '../helpers/factories/trips';+import { makeUser } from '../helpers/factories/users';+import { resetDatabase } from '../helpers/reset-database';+import { resetRateLimits } from '../helpers/test-db';import { MikroORM } from '@mikro-orm/core';import type { INestApplication } from '@nestjs/common';@@ -24,10 +27,6 @@ import { describe, it, expect, vi, beforeAll, beforeEach, afterAll } from 'vites// ── Hoisted DB mock ──────────────────────────────────────────────────────────-vi.mock('../../src/db/database', async () => {- const { createSnapshotTestDb, buildDbMock } = await import('../helpers/db-mock');- return buildDbMock(createSnapshotTestDb());-});vi.mock('../../src/utils/ssrfGuard', async () => {const actual = await vi.importActual<typeof import('../../src/utils/ssrfGuard')>('../../src/utils/ssrfGuard');return {@@ -64,10 +63,10 @@ async function requireTripPhoto(assetId: string, tripId: number) {}beforeEach(async () => {- resetTestDb(testDb);+ await resetDatabase(orm());await resetRateLimits(nestApp);// Providers only count as enabled under an enabled journey addon (migration 84 seeds it off).- setAddonEnabled(testDb, 'journey', true);+ await setAddonEnabled(orm(), 'journey', true);// The migrated snapshot seeds photo_providers.immich.enabled = 0 (an admin must// configure it before it's usable in production); the legacy test helper always// seeded it enabled, which is what these tests assume. Same convention@@ -77,7 +76,6 @@ beforeEach(async () => {afterAll(async () => {await nestApp.close();- testDb.close();});// ── Helpers ──────────────────────────────────────────────────────────────────@@ -93,14 +91,14 @@ function albumLinksUrl(tripId: number, linkId?: number) {describe('Unified photo management', () => {it('UNIFIED-001 — GET photos lists own + shared photos from other members', async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, member.id);+ const { user: owner } = await makeUser(orm());+ const { user: member } = await makeUser(orm());+ const trip = await makeTrip(orm(), owner.id);+ await addTripMember(orm(), trip.id, member.id);// owner has a private photo; member has a shared photo- addTripPhoto(testDb, trip.id, owner.id, 'asset-own', 'immich', { shared: false });- addTripPhoto(testDb, trip.id, member.id, 'asset-shared', 'immich', { shared: true });+ await addTripPhoto(orm(), trip.id, owner.id, 'asset-own', 'immich', { shared: false });+ await addTripPhoto(orm(), trip.id, member.id, 'asset-shared', 'immich', { shared: true });const res = await request(app).get(photosUrl(trip.id)).set('Cookie', authCookie(owner.id));@@ -111,12 +109,12 @@ describe('Unified photo management', () => {});it("UNIFIED-002 — GET photos excludes other members' private photos", async () => {- const { user: owner } = createUser(testDb);- const { user: member } = createUser(testDb);- const trip = createTrip(testDb, owner.id);- addTripMember(testDb, trip.id, member.id);+ const { user: owner } = await makeUser(orm());+ const { user: member } = await makeUser(orm());+ const trip = await makeTrip(orm(), owner.id);+ await addTripMember(orm(), trip.id, member.id);- addTripPhoto(testDb, trip.id, member.id, 'asset-private', 'immich', { shared: false });+ await addTripPhoto(orm(), trip.id, member.id, 'asset-private', 'immich', { shared: false });const res = await request(app).get(photosUrl(trip.id)).set('Cookie', authCookie(owner.id));@@ -126,9 +124,9 @@ describe('Unified photo management', () => {});it('UNIFIED-003 — GET photos returns 404 for non-member', async () => {- const { user: owner } = createUser(testDb);- const { user: stranger } = createUser(testDb);- const trip = createTrip(testDb, owner.id);+ const { user: owner } = await makeUser(orm());+ const { user: stranger } = await makeUser(orm());+ const trip = await makeTrip(orm(), owner.id);const res = await request(app).get(photosUrl(trip.id)).set('Cookie', authCookie(stranger.id));@@ -136,8 +134,8 @@ describe('Unified photo management', () => {});it('UNIFIED-004 — POST photos adds photos from selections', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm());+ const trip = await makeTrip(orm(), user.id);const res = await request(app).post(photosUrl(trip.id))@@ -156,8 +154,8 @@ describe('Unified photo management', () => {});it('UNIFIED-005 — POST photos with empty selections returns 400', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm());+ const trip = await makeTrip(orm(), user.id);const res = await request(app).post(photosUrl(trip.id)).set('Cookie', authCookie(user.id)).send({ selections: [] });@@ -165,8 +163,8 @@ describe('Unified photo management', () => {});it('UNIFIED-006 — POST photos with invalid provider returns 400', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm());+ const trip = await makeTrip(orm(), user.id);const res = await request(app).post(photosUrl(trip.id))@@ -177,9 +175,9 @@ describe('Unified photo management', () => {});it('UNIFIED-007 — PUT photos/sharing toggles shared flag', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- addTripPhoto(testDb, trip.id, user.id, 'asset-tog', 'immich', { shared: false });+ const { user } = await makeUser(orm());+ const trip = await makeTrip(orm(), user.id);+ await addTripPhoto(orm(), trip.id, user.id, 'asset-tog', 'immich', { shared: false });const trekRef = await requireTripPhoto('asset-tog', trip.id);const res = await request(app)@@ -193,9 +191,9 @@ describe('Unified photo management', () => {});it('UNIFIED-008 — PUT photos/sharing on non-member trip returns 404', async () => {- const { user: owner } = createUser(testDb);- const { user: stranger } = createUser(testDb);- const trip = createTrip(testDb, owner.id);+ const { user: owner } = await makeUser(orm());+ const { user: stranger } = await makeUser(orm());+ const trip = await makeTrip(orm(), owner.id);const res = await request(app).put(`${photosUrl(trip.id)}/sharing`)@@ -206,9 +204,9 @@ describe('Unified photo management', () => {});it('UNIFIED-009 — DELETE photos removes own photo', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- addTripPhoto(testDb, trip.id, user.id, 'asset-del', 'immich');+ const { user } = await makeUser(orm());+ const trip = await makeTrip(orm(), user.id);+ await addTripPhoto(orm(), trip.id, user.id, 'asset-del', 'immich');const trekRef = await requireTripPhoto('asset-del', trip.id);const res = await request(app)@@ -221,9 +219,9 @@ describe('Unified photo management', () => {});it('UNIFIED-009a — DELETE photos is held to the body contract, and still takes a numeric string', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- addTripPhoto(testDb, trip.id, user.id, 'asset-contract', 'immich');+ const { user } = await makeUser(orm());+ const trip = await makeTrip(orm(), user.id);+ await addTripPhoto(orm(), trip.id, user.id, 'asset-contract', 'immich');const trekRef = await requireTripPhoto('asset-contract', trip.id);// A DELETE that reads a body validates it like any other write, so a@@ -248,9 +246,9 @@ describe('Unified photo management', () => {});it('UNIFIED-010 — DELETE photos on non-member trip returns 404', async () => {- const { user: owner } = createUser(testDb);- const { user: stranger } = createUser(testDb);- const trip = createTrip(testDb, owner.id);+ const { user: owner } = await makeUser(orm());+ const { user: stranger } = await makeUser(orm());+ const trip = await makeTrip(orm(), owner.id);const res = await request(app).delete(photosUrl(trip.id))@@ -265,8 +263,8 @@ describe('Unified photo management', () => {describe('Unified album-link management', () => {it('UNIFIED-011 — POST album-links with missing provider returns 400', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm());+ const trip = await makeTrip(orm(), user.id);const res = await request(app).post(albumLinksUrl(trip.id))@@ -277,8 +275,8 @@ describe('Unified album-link management', () => {});it('UNIFIED-012 — POST album-links with missing album_id returns 400', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm());+ const trip = await makeTrip(orm(), user.id);const res = await request(app).post(albumLinksUrl(trip.id))@@ -289,8 +287,8 @@ describe('Unified album-link management', () => {});it('UNIFIED-013 — POST album-links duplicate link returns 409', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);+ const { user } = await makeUser(orm());+ const trip = await makeTrip(orm(), user.id);await request(app).post(albumLinksUrl(trip.id))@@ -306,9 +304,9 @@ describe('Unified album-link management', () => {});it('UNIFIED-014 — GET album-links only returns links for enabled providers', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- addAlbumLink(testDb, trip.id, user.id, 'immich', 'album-enabled');+ const { user } = await makeUser(orm());+ const trip = await makeTrip(orm(), user.id);+ await addAlbumLink(orm(), trip.id, user.id, 'immich', 'album-enabled');// Disable the immich providerawait updateRows(orm(), PhotoProviders, { id: 'immich' }, { enabled: 0 });@@ -322,15 +320,15 @@ describe('Unified album-link management', () => {});it('UNIFIED-021 — GET album-links reports no providers while the journey addon is off', async () => {- const { user } = createUser(testDb);- const trip = createTrip(testDb, user.id);- addAlbumLink(testDb, trip.id, user.id, 'immich', 'album-x');+ const { user } = await makeUser(orm());+ const trip = await makeTrip(orm(), user.id);+ await addAlbumLink(orm(), trip.id, user.id, 'immich', 'album-x');- setAddonEnabled(testDb, 'journey', false);+ await setAddonEnabled(orm(), 'journey', false);const res = await request(app).get(albumLinksUrl(trip.id)).set('Cookie', authCookie(user.id));- setAddonEnabled(testDb, 'journey', true);+ await setAddonEnabled(orm(), 'journey', true);expect(res.status).toBe(400); // provider rows still say enabled, journey off wins});diff --git a/server/tests/postgres/snapshot-suites-baseline.json b/server/tests/postgres/snapshot-suites-baseline.jsonindex fb33877d6..19805451b 100644--- a/server/tests/postgres/snapshot-suites-baseline.json+++ b/server/tests/postgres/snapshot-suites-baseline.json@@ -4,9 +4,6 @@"tests/integration/legacy-upgrade-v205.test.ts","tests/integration/legacy-upgrade-v242.test.ts","tests/integration/legacy-upgrade-v244.test.ts",- "tests/integration/memories-immich.test.ts",- "tests/integration/memories-synology.test.ts",- "tests/integration/memories-unified.test.ts","tests/integration/scheduler-gate.test.ts","tests/integration/security.test.ts","tests/integration/settings.test.ts",