Skip to content

fix(tests): guard missing image releases data in catalog test - #1570

Merged
castrojo merged 1 commit into
mainfrom
fix/catalog-test-ssr-unmocked-data
Oct 22, 2026
Merged

castrojo merged 1 commit into
mainfrom
fix/catalog-test-ssr-unmocked-data

Conversation

@castrojo

Copy link
Copy Markdown
Contributor

Problem

In clean CI checkouts (e.g., job 119610999752), gitignored static/data/image-releases.json is not present on disk before test execution, causing scripts/catalog-components.test.js to fail with Cannot find module .../static/data/image-releases.json.

Solution

  1. In scripts/catalog-components.test.js, fallback to { unavailable: true } when @site/static/data/*.json is missing on disk, following the standard in docs/skills/component-testing.md.
  2. Supply deterministic mock server releases to ImageProductSection for the unit test.
  3. In src/components/ImageProductSection.tsx, safely access releasesFile?.products?.[product] when the data file is unavailable.

Verification

  • npm test passed in full (all 1308 tests pass).
  • npm run test:coverage passed all thresholds.
  • npm run lint passed.

Handle unpopulated static data gracefully when loading ImageProductSection
in scripts/catalog-components.test.js during clean CI checkouts.

Assisted-by: Gemini 3.8 Flash via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@castrojo
castrojo added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit 7957bc7 Oct 22, 2026
3 checks passed
@castrojo
castrojo deleted the fix/catalog-test-ssr-unmocked-data branch October 22, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant