import { raw } from 'hono/html'; import { renderToString } from 'hono/jsx/dom/server'; import { describe, expect, it } from 'vitest'; import Atom from '@/views/atom'; describe('Atom view', () => { it('renders optional fields and media extensions', () => { const html = renderToString( ); expect(html).toContain('https://example.com/icon.png'); expect(html).toContain('https://example.com/logo.png'); expect(html).toContain('media:content'); expect(html).toContain('term="News"'); expect(html).toContain('term="Tech"'); expect(html).toContain('rsshub:upvotes'); expect(html).toContain('rsshub:downvotes'); expect(html).toContain('rsshub:comments'); }); it('renders multiple enclosure links with known sizes and deduplicates the legacy enclosure', () => { const html = renderToString( ); expect(html.match(/rel="enclosure"/g)).toHaveLength(2); expect(html).toContain('href="https://example.com/audio.mp3" type="audio/mpeg" length="123" title="Audio & notes"'); expect(html).toContain('href="https://example.com/cover.png" type="image/png"'); }); it('does not let hono hoist feed titles and links as document metadata', () => { const html = String( {raw('')} ); expect(html).toMatch(/^<\/head>