Skip to content

feat(atomic): migrate product section stories to MSW#7602

Merged
alexprudhomme merged 1 commit into
mainfrom
msw-commerce-product-sections
May 22, 2026
Merged

feat(atomic): migrate product section stories to MSW#7602
alexprudhomme merged 1 commit into
mainfrom
msw-commerce-product-sections

Conversation

@alexprudhomme
Copy link
Copy Markdown
Contributor

Problem

Commerce product section stories lack MSW (Mock Service Worker) API mocking, making them dependent on real API calls during testing.

Solution

Add MockCommerceApi handlers to all 9 product section component stories:

  • atomic-product-section-name
  • atomic-product-section-visual
  • atomic-product-section-metadata
  • atomic-product-section-description
  • atomic-product-section-emphasized
  • atomic-product-section-actions
  • atomic-product-section-badges
  • atomic-product-section-bottom-metadata
  • atomic-product-section-children

Each story now:

  • Instantiates MockCommerceApi harness
  • Registers MSW handlers via parameters.msw
  • Clears endpoints in beforeEach for test isolation

Add MockCommerceApi handlers and beforeEach cleanup to all 9
product section component stories for proper API mocking.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 21, 2026

⚠️ No Changeset found

Latest commit: 48d833c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@svcsnykcoveo
Copy link
Copy Markdown

svcsnykcoveo commented May 21, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 21, 2026

@coveo/atomic

npm i https://pkg.pr.new/@coveo/atomic@7602

@coveo/atomic-hosted-page

npm i https://pkg.pr.new/@coveo/atomic-hosted-page@7602

@coveo/atomic-legacy

npm i https://pkg.pr.new/@coveo/atomic-legacy@7602

@coveo/atomic-react

npm i https://pkg.pr.new/@coveo/atomic-react@7602

@coveo/auth

npm i https://pkg.pr.new/@coveo/auth@7602

@coveo/bueno

npm i https://pkg.pr.new/@coveo/bueno@7602

@coveo/create-atomic

npm i https://pkg.pr.new/@coveo/create-atomic@7602

@coveo/create-atomic-component

npm i https://pkg.pr.new/@coveo/create-atomic-component@7602

@coveo/create-atomic-component-project

npm i https://pkg.pr.new/@coveo/create-atomic-component-project@7602

@coveo/create-atomic-result-component

npm i https://pkg.pr.new/@coveo/create-atomic-result-component@7602

@coveo/create-atomic-rollup-plugin

npm i https://pkg.pr.new/@coveo/create-atomic-rollup-plugin@7602

@coveo/headless

npm i https://pkg.pr.new/@coveo/headless@7602

@coveo/headless-react

npm i https://pkg.pr.new/@coveo/headless-react@7602

@coveo/shopify

npm i https://pkg.pr.new/@coveo/shopify@7602

commit: 48d833c

@chromatic-com
Copy link
Copy Markdown

chromatic-com Bot commented May 21, 2026

Important

Testing in progress…

🟢 UI Tests: 366 tests unchanged
UI Review: Comparing 366 stories…
Storybook icon Storybook Publish: 366 stories published

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the Atomic commerce product section Storybook stories to use MSW-backed API mocking so they no longer depend on real commerce API calls during Storybook runs and automated story tests.

Changes:

  • Added a MockCommerceApi harness to each product section story file.
  • Registered the harness handlers via parameters.msw.handlers for Storybook/MSW integration.
  • Reset mock endpoint state per run via beforeEach calling clearAll() to improve isolation.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/atomic/src/components/commerce/atomic-product-section-visual/atomic-product-section-visual.new.stories.tsx Adds MockCommerceApi handlers + per-run reset for the visual section story.
packages/atomic/src/components/commerce/atomic-product-section-name/atomic-product-section-name.new.stories.tsx Adds MSW commerce API mocking and clears mocks before each run.
packages/atomic/src/components/commerce/atomic-product-section-metadata/atomic-product-section-metadata.new.stories.tsx Adds MSW commerce API mocking and clears mocks before each run.
packages/atomic/src/components/commerce/atomic-product-section-emphasized/atomic-product-section-emphasized.new.stories.tsx Adds MSW commerce API mocking and clears mocks before each run.
packages/atomic/src/components/commerce/atomic-product-section-description/atomic-product-section-description.new.stories.tsx Adds MSW commerce API mocking and clears mocks before each run (while keeping its custom engine preprocessing).
packages/atomic/src/components/commerce/atomic-product-section-children/atomic-product-section-children.new.stories.tsx Adds MSW commerce API mocking and clears mocks before each run.
packages/atomic/src/components/commerce/atomic-product-section-bottom-metadata/atomic-product-section-bottom-metadata.new.stories.tsx Adds MSW commerce API mocking and clears mocks before each run.
packages/atomic/src/components/commerce/atomic-product-section-badges/atomic-product-section-badges.new.stories.tsx Adds MSW commerce API mocking and clears mocks before each run.
packages/atomic/src/components/commerce/atomic-product-section-actions/atomic-product-section-actions.new.stories.tsx Adds MSW commerce API mocking and clears mocks before each run.

Merged via the queue into main with commit 82dbd51 May 22, 2026
74 of 75 checks passed
@alexprudhomme alexprudhomme deleted the msw-commerce-product-sections branch May 22, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants