chore(test): migrate from Enzyme to React Testing Library
Merged
ST
10mo ago+1331+1331+0123456789012345678901234567890123456789-462-462-012345678901234567890123456789
Summary
- Replace enzyme and enzyme-adapter-react-16 with @testing-library/react for React 18 compatibility
- Update react-test-renderer to v18
- Add TextEncoder polyfill for Node 18+ jsdom compatibility
- Migrate all existing tests to RTL idioms
- Add additional test coverage (45 tests total, 98%+ coverage)
Changes
Dependencies
- Added:
@testing-library/react,@testing-library/jest-dom,@testing-library/user-event - Removed:
enzyme,enzyme-adapter-react-16 - Updated:
react,react-dom,react-test-rendererto v18
Test Infrastructure
- New
setupTests/rtl.jswith TextEncoder polyfill and jest-dom matchers - Updated
jest.config.jsto usesetupFilesAfterEnv
Test Coverage
- Axis restrictions (x, y, none)
- Min/max constraints
- All callbacks (onResize, onResizeStart, onResizeStop)
- All 8 handle directions
- Event.persist handling
- Component unmounting
- Edge cases (no callbacks, no children)
Test plan
- All 45 tests pass
- Coverage at 98%+
- ESLint passes (1 minor warning)
- Flow has expected test-file ref nullability errors (non-blocking)