Files
immich-folio/lib/__tests__/slideshow.test.ts
Ralksta a813433891 release: v0.13.0 (#535)
Twenty-nine commits since v0.12.0. See CHANGELOG.md for the full list
and the upgrade notes.

Ten additions — the SEO package (site URL, robots.txt, sitemap.xml,
JSON-LD), slideshow mode, opt-in original downloads, copy-link,
previous/next album navigation, alt text from the Immich description,
per-album location precision, the update notice, a Help tab, and a
subpage cover grid separate from its photo grid. Two fixes: CJK album
slugs, and the lightbox control bar.

Photo of the Day (#476) was built on `dev` and reverted as not planned;
it never appears in a release.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01DmsHVRL9yQvckUB1ZpVWre

---------

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>
2026-08-25 10:08:12 +02:00

30 lines
1.0 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { nextSlideshowSpeed, SLIDESHOW_SPEEDS, type SlideshowSpeed } from '@/lib/slideshow';
describe('nextSlideshowSpeed', () => {
it('cycles off → 3s → 5s → 10s → off', () => {
expect(nextSlideshowSpeed(null)).toBe(3);
expect(nextSlideshowSpeed(3)).toBe(5);
expect(nextSlideshowSpeed(5)).toBe(10);
expect(nextSlideshowSpeed(10)).toBeNull();
});
it('returns to off after one full cycle, so the key always lets go', () => {
let speed: SlideshowSpeed = null;
for (let i = 0; i < SLIDESHOW_SPEEDS.length; i++) speed = nextSlideshowSpeed(speed);
expect(speed).toBeNull();
});
it('never yields a speed outside the advertised set', () => {
let speed: SlideshowSpeed = null;
for (let i = 0; i < 20; i++) {
speed = nextSlideshowSpeed(speed);
expect(SLIDESHOW_SPEEDS).toContain(speed);
}
});
it('re-enters the cycle from an unrecognised value rather than sticking', () => {
expect(nextSlideshowSpeed(7 as SlideshowSpeed)).toBe(3);
});
});