import test from 'node:test'; import assert from 'node:assert/strict'; import { feedJson, renderIndex, sitemapXml } from '../src/seo.js'; const id = 'a'.repeat(64); const meme = { id, createdAt: '2026-07-24T12:00:00.000Z', width: 1200, height: 900, moderationScore: 92 }; const template = [ '__SEO_TITLE__', '', '', '', '' ].join(''); test('renders a meme permalink with meme-specific share metadata', () => { const html = renderIndex({ template, baseUrl: 'https://memes.example', nonce: 'test-nonce', approvedCount: 1, meme }); assert.match(html, /Meme 0xAAAA\.\.\.AAAA \| The Meme Protocol<\/title>/); assert.match(html, new RegExp(`canonical" href="https://memes\\.example/meme/${id}"`)); assert.match(html, new RegExp(`og:image" content="https://memes\\.example/media/${id}"`)); assert.match(html, /"@type":"ImageObject"/); assert.match(html, /nonce="test-nonce"/); }); test('discovery feeds point readers to viewer permalinks', () => { const feed = feedJson('https://memes.example', [meme]); const sitemap = sitemapXml('https://memes.example', [meme]); assert.equal(feed.items[0].url, `https://memes.example/meme/${id}`); assert.equal(feed.items[0].image, `https://memes.example/media/${id}`); assert.match(sitemap, new RegExp(`https://memes\\.example/meme/${id}`)); });