Files
immich-folio/app/proof/__tests__/metadata.test.ts
Ralksta ad8b09700b release: v0.19.0
Release v0.19.0. See the `## [0.19.0] — 2026-09-29` section of
[CHANGELOG.md](https://github.com/ralksta/immich-folio/blob/dev/CHANGELOG.md)
for the full list.

Highlights: client proofing links (#683), custom content pages (#738),
asset picker search (#740), concurrent-edit detection (#742), env-locked
settings (#739), an accessibility baseline (#741), three security fixes
with advisories (#737, #755, #759), and a pre-release quality pass
(#780–#797).

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: ralksta <ralksta@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Ralf <rohlenbo79@gmail.com>
Co-authored-by: Paul Thies <110185070+ImScheinox@users.noreply.github.com>
Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
Co-authored-by: Lance Martin <lancetaylor95@gmail.com>
2026-09-29 22:50:30 +02:00

45 lines
1.6 KiB
TypeScript

import { describe, it, expect, vi, beforeEach } from 'vitest';
/**
* An expired proofing link rendered "This link has expired" under a tab that
* said "Not found". The tab still names nobody, but now agrees with the page.
*/
vi.mock('@/lib/proofSessions', async (importOriginal) => ({
...(await importOriginal<typeof import('@/lib/proofSessions')>()),
findSessionByToken: vi.fn(),
}));
vi.mock('@/lib/immich', () => ({ immich: {} }));
vi.mock('@/lib/config', () => ({
getConfig: vi.fn(),
getConfigOrNull: vi.fn(() => null),
hasExifPanelContent: vi.fn(),
}));
import { generateMetadata } from '../[token]/page';
import { findSessionByToken } from '@/lib/proofSessions';
const mockFind = findSessionByToken as unknown as ReturnType<typeof vi.fn>;
const params = Promise.resolve({ token: 'tok' });
beforeEach(() => mockFind.mockReset());
describe('proofing link tab title', () => {
it('says an expired link has expired, and names nobody', async () => {
mockFind.mockResolvedValue({ clientName: 'Anna', expiresOn: '2000-01-01', selection: [] });
const meta = await generateMetadata({ params });
expect(meta.title).toBe('This link has expired');
expect(String(meta.title)).not.toContain('Anna');
});
it('greets the client on a live link', async () => {
mockFind.mockResolvedValue({ clientName: 'Anna', expiresOn: null, selection: [] });
expect((await generateMetadata({ params })).title).toBe('Selection for Anna');
});
it('says not found for a link that never existed', async () => {
mockFind.mockResolvedValue(null);
expect((await generateMetadata({ params })).title).toBe('Not found');
});
});