import { raw } from 'hono/html'; import { renderToString } from 'hono/jsx/dom/server'; import Parser from 'rss-parser'; import { describe, expect, it } from 'vitest'; import RSS from '@/views/rss'; describe('RSS view', () => { it.each(['audio/mpeg', 'audio/mp4', 'video/mp4'])('preserves the explicit %s enclosure for RSS consumers', async (mimeType) => { const html = renderToString( ); expect(html).toContain(` { const html = renderToString( ); expect(html).toContain('xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"'); expect(html).toContain('xmlns:media="http://search.yahoo.com/mrss/"'); expect(html).toContain('xmlns:dc="http://purl.org/dc/elements/1.1/"'); expect(html).toContain('Host'); expect(html).not.toContain(''); expect(html).toContain('Podcast Author'); expect(html).toContain('itunes:category text="Tech"'); expect(html).toContain('true'); expect(html).toContain('31'); expect(html).toContain('88'); expect(html).toContain('media:content'); expect(html).toContain('Podcast'); expect(html).toContain('News'); }); it('uses the first attachment when no explicit enclosure is provided', () => { const html = renderToString( ); expect(html.match(/ { const html = renderToString( ); expect(html.match(/ { const html = String( {raw('')} ); expect(html).toMatch(/^<\/head>