• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ProjectOpenSea / opensea-js / 18514730422

15 Oct 2025 01:18AM UTC coverage: 83.839% (+33.8%) from 50.0%
18514730422

push

github

web-flow
refactor: major SDK/API restructure, improve test coverage (#1783)

* test: improve test coverage from 77% to 87.5%

## Summary
- Added 229 comprehensive unit tests across API clients and SDK managers
- Improved overall line coverage from ~77% to 87.5%
- Refactored monolithic files into focused modules following single-responsibility principle

## Test Coverage Improvements

### API Clients (src/api)
- collections.ts: 29% → 100% (+71%)
- listings.ts: 33% → 100% (+67%)
- nfts.ts: 40% → 100% (+60%)
- offers.ts: 35% → 100% (+65%)
- Overall src/api: 84.82% coverage

### SDK Managers (src/sdk)
- orders.ts: 13.75% → 97.5% (+83.75%)
- fulfillment.ts: 16.43% → 87.67% (+71.24%)
- Overall src/sdk: 70.44% coverage

### Utils (src/utils)
- Overall src/utils: 99.47% coverage

## New Test Files (229 tests)
- test/api/collections.spec.ts (19 tests)
- test/api/listings.spec.ts (27 tests)
- test/api/nfts.spec.ts (42 tests)
- test/api/offers.spec.ts (47 tests)
- test/sdk/ordersManager.spec.ts (48 tests)
- test/sdk/fulfillmentManager.spec.ts (46 tests)

## Refactoring (No Breaking Changes)

### API Module Split
- Extracted specialized API clients from monolithic api.ts
- Created: accounts.ts, collections.ts, listings.ts, nfts.ts, offers.ts, orders.ts
- All exports preserved via delegation pattern

### SDK Module Split
- Extracted manager classes from monolithic sdk.ts
- Created: assets.ts, cancellation.ts, fulfillment.ts, orders.ts, tokens.ts
- All public methods preserved via delegation

### Utils Module Split
- Extracted focused utilities from monolithic utils.ts
- Created: chain.ts, converters.ts, fees.ts, protocol.ts
- All exports re-exported from utils.ts for backward compatibility

### Shared Utilities
- Added getSeaportInstance() to eliminate duplicate implementations
- Added getSeaportVersion() for centralized version mapping

## Testing Approach
- Pure unit tests with comprehensive mocking
- No external dependencies (API/blockchain calls)
- Edge case coverage (... (continued)

360 of 555 branches covered (64.86%)

Branch coverage included in aggregate %.

2039 of 2303 new or added lines in 31 files covered. (88.54%)

2706 of 3102 relevant lines covered (87.23%)

2.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

56.83
/src/api/api.ts


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc