Files
immich-folio/lib/__tests__/config-default-title.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

60 lines
1.8 KiB
TypeScript

import { describe, it, expect, vi, beforeEach } from 'vitest';
// No SITE_TITLE, so the title has to come from the locale.
vi.mock('@/lib/env', () => ({
env: {
IMMICH_API_URL: 'http://localhost:2283',
IMMICH_API_KEY: 'test-key',
SITE_TITLE: '',
SITE_SUBTITLE: '',
CACHE_TTL: 300,
RATE_LIMIT_RPM: 120,
},
normalizeApiUrl: (raw: string) => raw.replace(/\/+$/, ''),
}));
vi.mock('@/lib/secret', () => ({
resolveAuthSecret: () => 'test-auth-secret-32-chars-long-min',
}));
vi.mock('@/lib/config/parser', () => ({
loadYaml: vi.fn(),
clearYamlCache: vi.fn(),
validateUuid: (id: string) => id,
}));
import { getConfig, invalidateConfigCache } from '@/lib/config';
import { loadYaml } from '@/lib/config/parser';
const ALBUM_ID = '11111111-1111-1111-1111-111111111111';
function mockYamlFiles(settings: Record<string, unknown>) {
vi.mocked(loadYaml).mockImplementation((filename: string) => {
if (filename === 'gallery.yaml') return { albums: [ALBUM_ID] };
if (filename === 'settings.yaml') return settings;
return null;
});
}
// With neither settings.yaml `title` nor SITE_TITLE set, the site used to be
// called "Gallery" in every language (#696).
describe('default site title', () => {
beforeEach(() => invalidateConfigCache());
it('uses the configured locale', () => {
mockYamlFiles({ lang: 'de' });
expect(getConfig().siteTitle).toBe('Galerie');
expect(getConfig().seo.title).toBe('Galerie');
});
it('falls back to English for an unsupported locale', () => {
mockYamlFiles({ lang: 'ja' });
expect(getConfig().siteTitle).toBe('Gallery');
});
it('keeps an explicit title', () => {
mockYamlFiles({ lang: 'de', title: 'Mein Folio' });
expect(getConfig().siteTitle).toBe('Mein Folio');
});
});