@@ -3,7 +3,7 @@ import { before, describe, it } from 'node:test';
33import { sitemap } from './fixtures/static/deps.mjs' ;
44import { loadFixture , readXML } from './test-utils.js' ;
55
6- describe ( 'Filter support ' , ( ) => {
6+ describe ( 'Config ' , ( ) => {
77 /** @type {import('./test-utils.js').Fixture } */
88 let fixture ;
99
@@ -14,17 +14,26 @@ describe('Filter support', () => {
1414 integrations : [
1515 sitemap ( {
1616 filter : ( page ) => page === 'http://example.com/one/' ,
17+ xslURL : '/sitemap.xsl' ,
1718 } ) ,
1819 ] ,
1920 } ) ;
2021 await fixture . build ( ) ;
2122 } ) ;
2223
23- it ( 'Just one page is added' , async ( ) => {
24+ it ( 'filter: Just one page is added' , async ( ) => {
2425 const data = await readXML ( fixture . readFile ( '/sitemap-0.xml' ) ) ;
2526 const urls = data . urlset . url ;
2627 assert . equal ( urls . length , 1 ) ;
2728 } ) ;
29+
30+ it ( 'xslURL: Includes xml-stylsheet' , async ( ) => {
31+ const xml = await fixture . readFile ( '/sitemap-0.xml' ) ;
32+ assert . ok (
33+ xml . includes ( '<?xml-stylesheet type="text/xsl" href="http://example.com/sitemap.xsl"?>' ) ,
34+ xml ,
35+ ) ;
36+ } ) ;
2837 } ) ;
2938
3039 describe ( 'SSR' , ( ) => {
@@ -34,16 +43,25 @@ describe('Filter support', () => {
3443 integrations : [
3544 sitemap ( {
3645 filter : ( page ) => page === 'http://example.com/one/' ,
46+ xslURL : '/sitemap.xsl' ,
3747 } ) ,
3848 ] ,
3949 } ) ;
4050 await fixture . build ( ) ;
4151 } ) ;
4252
43- it ( 'Just one page is added' , async ( ) => {
53+ it ( 'filter: Just one page is added' , async ( ) => {
4454 const data = await readXML ( fixture . readFile ( '/client/sitemap-0.xml' ) ) ;
4555 const urls = data . urlset . url ;
4656 assert . equal ( urls . length , 1 ) ;
4757 } ) ;
58+
59+ it ( 'xslURL: Includes xml-stylsheet' , async ( ) => {
60+ const xml = await fixture . readFile ( '/client/sitemap-0.xml' ) ;
61+ assert . ok (
62+ xml . includes ( '<?xml-stylesheet type="text/xsl" href="http://example.com/sitemap.xsl"?>' ) ,
63+ xml ,
64+ ) ;
65+ } ) ;
4866 } ) ;
4967} ) ;
0 commit comments