Skip to content

Conversation

@AlexanderKolberg
Copy link
Member

Summary

  • Extract determineCheckoutMode into a separate testable pure function
  • Add comprehensive unit tests for all checkout mode scenarios
  • Export missing CreateListingModalContext type for headless implementations

Changes

New Files

  • sdk/src/react/ui/modals/BuyModal/internal/determineCheckoutMode.ts - Extracted checkout mode logic
  • sdk/src/react/ui/modals/BuyModal/internal/__tests__/determineCheckoutMode.test.ts - 9 unit tests

Modified Files

  • sdk/src/react/ui/modals/BuyModal/internal/buyModalContext.ts - Use extracted function
  • sdk/src/react/ui/index.ts - Export CreateListingModalContext type

Test Coverage

Scenario Test
Trails mode (chain + order supported)
Trails fallback (chain supported, order not)
Trails fallback (chain not supported)
Sequence-checkout mode
Crypto mode explicit
Undefined config

Context

This improves v2 release readiness by:

  1. Testing critical Trails checkout flow logic
  2. Completing headless mode type exports

- Extract determineCheckoutMode into separate testable function
- Add 9 unit tests covering all checkout mode scenarios:
  - Trails mode with chain/order support
  - Trails fallback to crypto when not supported
  - Sequence-checkout mode passthrough
  - Crypto mode explicit config
  - Undefined config handling
- Export missing CreateListingModalContext type
Copy link
Contributor

@mithatakbulut mithatakbulut left a comment

Choose a reason for hiding this comment

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

LGTM

@AlexanderKolberg AlexanderKolberg merged commit 790d2b7 into master Jan 17, 2026
3 checks passed
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.

3 participants