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>
59 lines
1.9 KiB
TypeScript
59 lines
1.9 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { albumNeighbours } from '@/lib/albumNav';
|
|
|
|
const album = (id: string, slug = id, albumName = id.toUpperCase()) => ({ id, slug, albumName });
|
|
|
|
const three = [album('a'), album('b'), album('c')];
|
|
|
|
describe('albumNeighbours', () => {
|
|
it('offers both neighbours in the middle of a list', () => {
|
|
expect(albumNeighbours(three, 'b')).toEqual({
|
|
prev: { href: '/a', name: 'A' },
|
|
next: { href: '/c', name: 'C' },
|
|
});
|
|
});
|
|
|
|
it('omits the previous link on the first album', () => {
|
|
expect(albumNeighbours(three, 'a')).toEqual({ next: { href: '/b', name: 'B' } });
|
|
});
|
|
|
|
it('omits the next link on the last album — no wrap-around', () => {
|
|
expect(albumNeighbours(three, 'c')).toEqual({ prev: { href: '/b', name: 'B' } });
|
|
});
|
|
|
|
it('prefixes hrefs with the subpage path when there is one', () => {
|
|
expect(albumNeighbours(three, 'b', '/travel')).toEqual({
|
|
prev: { href: '/travel/a', name: 'A' },
|
|
next: { href: '/travel/c', name: 'C' },
|
|
});
|
|
});
|
|
|
|
it('returns nothing for a single-album list', () => {
|
|
expect(albumNeighbours([album('a')], 'a')).toEqual({});
|
|
});
|
|
|
|
it('returns nothing for an empty list', () => {
|
|
expect(albumNeighbours([], 'a')).toEqual({});
|
|
});
|
|
|
|
it('returns nothing when the album is not in the list', () => {
|
|
expect(albumNeighbours(three, 'zzz')).toEqual({});
|
|
});
|
|
|
|
it('follows list order, not slug or name order', () => {
|
|
const shuffled = [album('c'), album('a'), album('b')];
|
|
expect(albumNeighbours(shuffled, 'a')).toEqual({
|
|
prev: { href: '/c', name: 'C' },
|
|
next: { href: '/b', name: 'B' },
|
|
});
|
|
});
|
|
|
|
it('uses the slug for the href and the display name for the label', () => {
|
|
const list = [album('id-1', 'harbour-at-dawn', 'Harbour at Dawn'), album('id-2')];
|
|
expect(albumNeighbours(list, 'id-2').prev).toEqual({
|
|
href: '/harbour-at-dawn',
|
|
name: 'Harbour at Dawn',
|
|
});
|
|
});
|
|
});
|