import { describe, expect, it } from 'vitest'; import { getSeo } from './seo'; describe('public page metadata', () => { it('gives the homepage a descriptive title and production canonical URL', () => { const seo = getSeo('/'); expect(seo.title).toBe('Projects, lists and writing | Stan Runge'); expect(seo.url).toBe('https://stanrunge.dev/'); expect(seo.indexable).toBe(true); expect(seo.image).toBe('https://stanrunge.dev/moon.jpg'); }); it('uses article content and its latest edit time', () => { const article = getSeo('/blog/my-post', { blogArticle: { title: 'My post', content: 'A **specific** article about lists.', updatedAt: '2026-09-02T00:00:00.000Z' } }); expect(article.title).toBe('My post | Stan Runge'); expect(article.description).toBe('A specific article about lists.'); expect(article.type).toBe('article'); expect(article.modifiedAt).toBe('2026-09-02T00:00:00.000Z'); }); it('describes a list using its contents', () => { const seo = getSeo('/lists/vinyls-to-collect', { list: { name: 'Vinyls to collect', isProgress: true, items: [{ name: 'Album one' }, { name: 'Album two' }] } }); expect(seo.title).toBe('Vinyls to collect | Stan Runge'); expect(seo.description).toContain('Album one, Album two'); expect(seo.indexable).toBe(true); }); it('keeps private and staging pages out of search results', () => { expect(getSeo('/login').indexable).toBe(false); expect(getSeo('/projects/animaldex/register').indexable).toBe(false); expect( getSeo('/blog/my-post/edit', { blogArticle: { title: 'My post', content: '', updatedAt: '' } }).indexable ).toBe(false); expect(getSeo('/projects/catch-em-all', {}, 'STAGING').indexable).toBe(false); }); });