Test/marketplace card#1202
Open
wonderfulmarv01 wants to merge 6 commits into
Open
Conversation
…y improvements and new features - Added TrustBadge component to the marketplace page. - Updated CreateCommitmentStepConfigure to improve accessibility by changing form to a div with role and aria-label. - Modified CreateCommitmentStepReview to replace labels with paragraphs for better semantics and added buttons for checkbox interactions. - Improved MarketplaceHeader by changing the mobile menu overlay to a button for better accessibility. - Refactored RecentAttestationsPanel to remove unnecessary roles and improve semantics. - Updated HeroSection links to use the Link component directly for better performance and accessibility. - Simplified ProblemSection by removing unnecessary role attributes. - Added accessibility comments in CommitmentDisputeModal. - Adjusted tsconfig.json for better JSX handling and improved formatting.
…cross frontend components
|
Someone is attempting to deploy a commit to the 1nonly's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
closes #733
This pull request introduces comprehensive unit and integration test coverage for the core MarketplaceCard component (src/components/MarketplaceCard.tsx). In addition, it fixes minor React console warnings regarding non-camelCased SVG attributes.
Key Changes
Added a new, fully comprehensive test suite in
MarketplaceCard.test.tsx
verifying all functions, edge cases, and components:
Score Clamping (clampScore):
Clamping negative numbers, NaN, and scores above 100 to boundaries 0% and 100%.
Proper rounding of decimal values (e.g. 84.6 → 85%, 22.3 → 22%).
Address Truncation (truncateAddress):
Length ≤ 12 (e.g. 0123456789ab) remains unchanged.
Length > 12 (e.g. 0123456789abc) gets truncated to the 6...4 form (012345...9abc).
Graceful handling of empty, whitespace, null, and undefined owner addresses.
Sale States and Trade CTA:
Verification of price and trade button when forSale is true.
Verification of "Not for sale" badge when forSale is false (with trade CTA hidden).
Respecting custom tradeHref values and correctly falling back to default URL routing patterns when tradeHref is absent.
Commitment Type Customizations:
Style checking (class names, colors, border colors, badge variations) and SVG correctness verification for Safe, Balanced, and Aggressive cards.
Modal Mounting and Closing Paths:
Asserting the CommitmentDetailsModal mounts when clicking "View" on cards (both for-sale and not-for-sale).
Asserting the modal correctly closes when onClose is triggered.
2. Component Cleanups
Fixed invalid SVG properties in src/components/MarketplaceCard.tsx (changed stroke-width, stroke-linecap, and stroke-linejoin to camelCase equivalents strokeWidth, strokeLinecap, and strokeLinejoin) to resolve console/stderr warnings during test execution.
Verification Results
All tests execute successfully in a happy-dom Vitest environment.
Total Tests: 24 / 24 passing.
Test Coverage: 100% Statements, 100% Branches, 100% Functions, and 100% Lines on MarketplaceCard.tsx.