test(server): follow the signatures the session and port work changed

The session gate passes a session lookup to verifyJwtAndLoadUser, the
Immich save takes auto_upload, getAppUrl stays synchronous, the demo
session list marks the current session by the id it is handed, and the
lease no longer needs a transaction of its own, so its spec is gone.
This commit is contained in:
Maurice
2026-10-08 20:22:16 +02:00
parent 37af6f4ff9
commit da97d7535f
6 changed files with 27 additions and 34 deletions
@@ -95,7 +95,11 @@ describe('SessionsController on a demo instance', () => {
vi.stubEnv('DEMO_MODE', 'true');
const mine = { id: SID, created_at: 'a', last_seen_at: 'b', expires_at: 'c', user_agent: 'Mine', current: true };
const theirs = { id: OTHER, created_at: 'a', last_seen_at: 'b', expires_at: 'c', user_agent: 'Another visitor', current: false };
const { c } = controller({ list: vi.fn().mockResolvedValue([theirs, mine]) });
// Flags `current` from the id it is handed, as SessionsService.list does:
// a request without a tracked token has no current session at all.
const list = vi.fn((_userId: number, currentId?: string) =>
Promise.resolve([theirs, mine].map((session) => ({ ...session, current: session.id === currentId }))));
const { c } = controller({ list });
expect(await c.list(demo, reqWith(SID))).toEqual({ sessions: [mine], current_tracked: true });
expect(await c.list(demo, reqWith())).toEqual({ sessions: [], current_tracked: false });