Commit b6a62e0
fix(tests): correct TypeScript types in cross-module integration tests - proper fix without unknown assertions
Fixed all TypeScript type errors in cross-module-examples.integration.test.ts with full type safety:
FIXED - ProductStatisticsResponse Structure (9 original errors):
- Updated mock data to match actual ProductStatisticsResponse interface
- Changed data: [...] to data: { page, isNextPage, cards: [...] }
- Added complete ProductCardAnalytics objects with statistics, stocks, tags, object
- Updated all test code: analytics.data → analytics.data.cards
- Fixed reduce methods with proper typed parameters
FIXED - Review/Question Types:
- Updated Review mock data to include productDetails.nmId structure
- Updated Question mock data to include productDetails.nmId structure
- Updated all test code: review.nmId → review.productDetails.nmId
- Updated all test code: question.nmId → question.productDetails.nmId
FIXED - Transaction Types:
- Replaced minimal mock with complete Transaction interface fields
- Updated all test field references: transactionId → rrd_id, nmId → nm_id, saleID → srid
- Added all required Transaction fields per finances.types.ts
FIXED - SalesItem Types:
- Replaced minimal mock with complete SalesItem interface fields
- Added all required SalesItem fields per reports.types.ts
- Fixed date field usage: sale_dt → date (for sales objects)
- Removed incorrect sale_dt fields from SalesItem mocks
FIXED - getSales() Method Signature:
- Corrected all calls from getSales({dateFrom, dateTo}) to getSales(dateFrom)
- Method signature per Swagger: getSales(dateFrom: string, flag?: number)
- Fixed 10 incorrect method calls throughout tests
Result:
- ✅ All TypeScript type errors fixed (20+ errors)
- ✅ Zero 'unknown' type assertions used - full type safety
- ✅ All 27 integration tests passing
- ✅ Mock data now fully complies with SDK type definitions
- ✅ Proper fix following actual API/SDK interfaces
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 10c6e55 commit b6a62e0
1 file changed
Lines changed: 528 additions & 137 deletions
0 commit comments