@@ -4,6 +4,7 @@ import { setupServer } from 'msw/node';
44import { getCheck } from '../../../src/checks/registry.js' ;
55import { createContext } from '../../../src/runner.js' ;
66import type { DiscoveredFile } from '../../../src/types.js' ;
7+ import { mockSitemapNotFound } from '../../helpers/mock-sitemap-not-found.js' ;
78import {
89 hasLocaleCodeAt ,
910 filterToUnprefixedLocale ,
@@ -288,15 +289,7 @@ describe('llms-txt-coverage', () => {
288289 const host = 'cov-no-sitemap.local' ;
289290 const ctx = makeCtx ( host , [ `http://${ host } /docs/page` ] , '/docs' ) ;
290291
291- server . use (
292- http . get ( `http://${ host } /robots.txt` , ( ) => new HttpResponse ( '' , { status : 404 } ) ) ,
293- http . get ( `http://${ host } /sitemap.xml` , ( ) => new HttpResponse ( '' , { status : 404 } ) ) ,
294- http . get ( `http://${ host } /docs/sitemap.xml` , ( ) => new HttpResponse ( '' , { status : 404 } ) ) ,
295- http . get (
296- `http://${ host } /docs/sitemap-index.xml` ,
297- ( ) => new HttpResponse ( '' , { status : 404 } ) ,
298- ) ,
299- ) ;
292+ mockSitemapNotFound ( server , `http://${ host } /docs` ) ;
300293
301294 const result = await check . run ( ctx ) ;
302295 expect ( result . status ) . toBe ( 'skip' ) ;
@@ -527,10 +520,8 @@ describe('llms-txt-coverage', () => {
527520
528521 const ctx = makeCtx ( host , docPages , '/docs' ) ;
529522
523+ mockSitemapNotFound ( server , `http://${ host } /docs` ) ;
530524 server . use (
531- // No main sitemap
532- http . get ( `http://${ host } /robots.txt` , ( ) => new HttpResponse ( '' , { status : 404 } ) ) ,
533- http . get ( `http://${ host } /sitemap.xml` , ( ) => new HttpResponse ( '' , { status : 404 } ) ) ,
534525 // Docs sitemap is an index
535526 http . get (
536527 `http://${ host } /docs/sitemap.xml` ,
@@ -548,10 +539,6 @@ describe('llms-txt-coverage', () => {
548539 headers : { 'content-type' : 'application/xml' } ,
549540 } ) ,
550541 ) ,
551- http . get (
552- `http://${ host } /docs/sitemap-index.xml` ,
553- ( ) => new HttpResponse ( '' , { status : 404 } ) ,
554- ) ,
555542 ) ;
556543
557544 const result = await check . run ( ctx ) ;
0 commit comments