import { renderIndex } from '../../render/renderIndex.js'; describe('renderIndex', () => { it('renders a child as baseUrl + /sitemap-.xml', () => { const xml = renderIndex( [{ name: 'products', lastmod: '2026-01-01T00:00:00.000Z' }], 'https://shop.com' ); expect(xml).toContain( '' ); expect(xml).toContain('https://shop.com/sitemap-products.xml'); expect(xml).toContain('2026-01-01T00:00:00.000Z'); }); it('renders multiple children', () => { const xml = renderIndex( [{ name: 'products' }, { name: 'categories' }], 'https://shop.com' ); expect(xml).toContain('https://shop.com/sitemap-products.xml'); expect(xml).toContain('https://shop.com/sitemap-categories.xml'); expect((xml.match(//g) || []).length).toBe(2); }); it('omits when absent', () => { const xml = renderIndex([{ name: 'static' }], 'https://shop.com'); expect(xml).not.toContain(''); }); it('renders an empty index for no children', () => { const xml = renderIndex([], 'https://shop.com'); expect(xml).toContain(''); expect(xml).not.toContain(''); }); });