Skip to content

test[faustwp-core]: (#1940) add test coverage for sitemapIndexPath option#2321

Open
latenighthackathon wants to merge 2 commits intowpengine:canaryfrom
latenighthackathon:test/sitemap-index-path-coverage
Open

test[faustwp-core]: (#1940) add test coverage for sitemapIndexPath option#2321
latenighthackathon wants to merge 2 commits intowpengine:canaryfrom
latenighthackathon:test/sitemap-index-path-coverage

Conversation

@latenighthackathon
Copy link
Copy Markdown

Description

The sitemapIndexPath configuration option in createRootSitemapIndex() had zero test coverage. This PR adds three tests verifying its behavior:

  1. Custom path — confirms createRootSitemapIndex fetches from the custom URL when sitemapIndexPath is provided (e.g. /custom-sitemap-index.xml)
  2. Default fallback — confirms it fetches from /sitemap.xml when sitemapIndexPath is omitted
  3. Slash trimming — confirms leading/trailing slashes are trimmed from sitemapIndexPath before constructing the fetch URL

Related Issues

Closes #1940

Testing

Confirm the issue (before the fix)

1. Verify no sitemapIndexPath tests exist:

grep -n "sitemapIndexPath" packages/faustwp-core/tests/server/sitemaps/createSitemaps.test.ts
# Expected on canary: no output

Confirm the fix

2. Verify sitemapIndexPath tests are present:

grep -n "sitemapIndexPath" packages/faustwp-core/tests/server/sitemaps/createSitemaps.test.ts
# Expected: 3 test cases referencing sitemapIndexPath

3. Run the sitemap tests:

npx jest --config packages/faustwp-core/jest.config.js --verbose -- createSitemaps
# Expected: 15 tests pass (12 existing + 3 new)

Run the full test suite

npm install && npm run build && npm run test

…xPath option

Add three tests to createSitemaps.test.ts verifying sitemapIndexPath
behavior in createRootSitemapIndex():

- Fetches from custom sitemapIndexPath when provided
- Falls back to default /sitemap.xml when not provided
- Trims leading/trailing slashes from sitemapIndexPath

Closes wpengine#1940
@latenighthackathon latenighthackathon requested a review from a team as a code owner April 3, 2026 05:57
@headless-platform-by-wp-engine
Copy link
Copy Markdown

Currently, we do not support the creation of preview deployments based on changes coming from forked repositories.
Learn more about preview environments in our documentation.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 3, 2026

🦋 Changeset detected

Latest commit: cb09f51

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@faustwp/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation bot moved this to 🆕 Backlog in Headless OSS Apr 3, 2026
@ahuseyn ahuseyn moved this from 🆕 Backlog to 👀 In review in Headless OSS Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

Add supporting tests for sitemapIndexPath option

2 participants