🔧 Resolve Test Suite Failures and URL.canParse Compatibility#91
Merged
cristiantela merged 4 commits intov3-mainfrom Apr 17, 2026
Merged
🔧 Resolve Test Suite Failures and URL.canParse Compatibility#91cristiantela merged 4 commits intov3-mainfrom
URL.canParse Compatibility#91cristiantela merged 4 commits intov3-mainfrom
Conversation
URL.canParse is not available in the jsdom test environment and older runtimes. Using try/catch with new URL() achieves the same behavior. Made-with: Cursor
The SVG rule must come before the generic @/ alias so that imports like @/assets/icons/foo.svg?react are intercepted before the alias tries to resolve the ?react query suffix as a real file path. Made-with: Cursor
- Update ConversationStarterButton test to assert weni-fs-button class after component was migrated from Button to FSButton - Add missing config field to Cart test mock context to prevent TypeError when CounterControls accesses config.addToCart Made-with: Cursor
- Call AudioCapture.requestPermission() and checkPermission() as static methods; instance calls were causing TypeError - Remove manual @/utils/icons mock from VoiceMode tests since moduleNameMapper already handles all SVG imports globally Made-with: Cursor
paulobernardoaf
approved these changes
Apr 17, 2026
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.
Description
Type of Change
Motivation and Context
The test suite had several failures caused by outdated assertions, incomplete mock contexts, incorrect method call types (instance vs. static), and a misconfigured Jest module resolver. Additionally,
URL.canParseis not available in the jsdom test environment or in older runtimes, causing runtime errors. These issues were preventing the test suite from running cleanly.Summary of Changes
src/components/Product/InlineProduct.jsx— ReplacedURL.canParse()with atry/catchblock usingnew URL(), which is universally supported across all environments including jsdomjest.config.js— Moved the SVGmoduleNameMapperrule before the@/alias rule so that imports like@/assets/icons/foo.svg?reactare correctly intercepted before the alias resolver tries to treat?reactas part of the file pathsrc/components/ConversationStarters/ConversationStarters.test.jsx— Updated assertion from.weni-buttonto.weni-fs-buttonto reflect the component's migration fromButtontoFSButtonsrc/views/Cart.test.jsx— Added missingconfigfield to theuseChatContextmock return value, preventing aTypeErrorwhenCounterControlsaccessesconfig.addToCarttest/services/voice/AudioCapture.test.js— FixedrequestPermission()andcheckPermission()calls to useAudioCaptureas the receiver (static methods), not a class instance; consolidated redundantdescribeblocktest/components/VoiceMode/VoiceModeButton.test.jsxandVoiceModeError.test.jsx— Removed manual@/utils/iconsProxy mocks that were unnecessary sincemoduleNameMapperalready handles all SVG imports globally, and were causingReferenceErrordue to Jest'sjest.mockhoisting behavior