release: v0.16.0
See CHANGELOG.md for the full v0.16.0 entry. --------- 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>
This commit is contained in:
@@ -15,6 +15,7 @@ vi.mock('@/lib/env', () => ({
|
||||
import {
|
||||
slugify,
|
||||
albumSlug,
|
||||
findAlbumSlugCollisions,
|
||||
normalizeSlug,
|
||||
buildSubpageGrid,
|
||||
sanitizeNavLinks,
|
||||
@@ -125,6 +126,55 @@ describe('albumSlug', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('findAlbumSlugCollisions', () => {
|
||||
it('groups albums whose names slugify alike', () => {
|
||||
const collisions = findAlbumSlugCollisions([
|
||||
{ id: 'a', name: 'Japan Trip' },
|
||||
{ id: 'b', name: 'Japan-Trip' },
|
||||
{ id: 'c', name: 'Iceland' },
|
||||
]);
|
||||
expect(collisions).toEqual([
|
||||
{
|
||||
slug: 'japan-trip',
|
||||
albums: [
|
||||
{ id: 'a', name: 'Japan Trip' },
|
||||
{ id: 'b', name: 'Japan-Trip' },
|
||||
],
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('reports nothing when every slug is distinct', () => {
|
||||
expect(
|
||||
findAlbumSlugCollisions([
|
||||
{ id: 'a', name: 'Japan Trip' },
|
||||
{ id: 'b', name: 'Iceland' },
|
||||
]),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
// albumSlug() falls back to the id for these, which is unique by
|
||||
// construction — two emoji-only albums do not actually collide.
|
||||
it('does not flag two names that both slugify to nothing', () => {
|
||||
expect(
|
||||
findAlbumSlugCollisions([
|
||||
{ id: 'a', name: '🎉' },
|
||||
{ id: 'b', name: '🎊' },
|
||||
]),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it('groups three or more colliding names together', () => {
|
||||
const collisions = findAlbumSlugCollisions([
|
||||
{ id: 'a', name: 'Trip' },
|
||||
{ id: 'b', name: 'TRIP' },
|
||||
{ id: 'c', name: 'trip' },
|
||||
]);
|
||||
expect(collisions).toHaveLength(1);
|
||||
expect(collisions[0].albums).toHaveLength(3);
|
||||
});
|
||||
});
|
||||
|
||||
describe('normalizeSlug', () => {
|
||||
// Next hands catch-all route segments over percent-encoded, so this is the
|
||||
// half of #522 that fixing slugify() alone did not cure.
|
||||
|
||||
Reference in New Issue
Block a user