test(content-blog): regression-test trailingSlash on feed URLs (AI-assisted)#12022
Open
LeSingh1 wants to merge 1 commit into
Open
test(content-blog): regression-test trailingSlash on feed URLs (AI-assisted)#12022LeSingh1 wants to merge 1 commit into
LeSingh1 wants to merge 1 commit into
Conversation
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-flight checklist
Motivation
Adds an explicit regression test for the trailing-slash behavior of blog feed URLs. The existing
feed.test.ts > with trailing slashsnapshot already captures the URLs, but a regression infeed.tswould just nudge the snapshot and could pass review unnoticed. This adds a programmatic assertion that fails loudly with a descriptive message.What this PR does
In
packages/docusaurus-plugin-content-blog/src/__tests__/feed.test.ts, inside the existingdescribe.each(['atom', 'rss', 'json'])block, adds one new test that:trailingSlash: trueagainst the existing__fixtures__/websitefixture,<id>,<link>,<guid>, JSONid/url/home_page_url/feed_url) because CDATA bodies andcontent_htmlmay legitimately contain author-written non-slashed links,/,try / finallywithfsMock.mockClear()so a failure in one parameterized variant doesn't leak fsMock state into the next.No production code is changed.
Test plan
yarn test packages/docusaurus-plugin-content-blog/src/__tests__/feed.test.ts— 24/24 pass.yarn tsc --noEmitfor the package — clean.yarn lint:js— no new warnings.applyTrailingSlashfromfeed.ts:130and confirmed all 3 new parameterized variants fail with the descriptive messageatom/rss/json feed URL should end with "/"; restored after.Related issue
Adds explicit regression coverage for #7656.
The behavior is already correct on current
main, so this PR does not change production code. It makes the feed URL trailing-slash behavior fail loudly if it regresses again.Notes
AI-assisted, per
AGENTS.md.