diff --git a/packages/gitbook/tests/rss.test.ts b/packages/gitbook/tests/rss.test.ts index 4c99dc6fd..434dcbbdf 100644 --- a/packages/gitbook/tests/rss.test.ts +++ b/packages/gitbook/tests/rss.test.ts @@ -3,12 +3,18 @@ import Parser from 'rss-parser'; import { getContentTestURL } from './utils'; +// Fetch via global fetch so the browserless preload attaches the Vercel protection bypass header. +async function parseFeed(url: string) { + const response = await fetch(url); + expect(response.status).toBe(200); + return new Parser().parseString(await response.text()); +} + it('should expose a RSS feed for a page with updates', async () => { - const parser = new Parser(); const feedURL = getContentTestURL( 'https://gitbook.gitbook.io/test-gitbook-open/blocks/updates/rss.xml' ); - const feed = await parser.parseURL(feedURL); + const feed = await parseFeed(feedURL); expect(feed.title).toBe('Updates | E2E Tests GitBook Open'); expect(feed.items.length).toBe(4); @@ -16,10 +22,7 @@ it('should expose a RSS feed for a page with updates', async () => { }); it('should keep list structure in RSS feed items', async () => { - const parser = new Parser(); - const feed = await parser.parseURL( - getContentTestURL('https://gitbook.com/docs/changelog/rss.xml') - ); + const feed = await parseFeed(getContentTestURL('https://gitbook.com/docs/changelog/rss.xml')); const withList = feed.items.find((item) => item['content:encoded']?.includes('