Skip to content

Add PriceChart component tests for mount and series updates - #385

Open
Benedict315 wants to merge 10 commits into
TevaLabs:mainfrom
Benedict315:main
Open

Add PriceChart component tests for mount and series updates#385
Benedict315 wants to merge 10 commits into
TevaLabs:mainfrom
Benedict315:main

Conversation

@Benedict315

Copy link
Copy Markdown
Contributor

Created comprehensive test suite for PriceChart.test.tsx with 20 passing tests covering:

Test Suites:

Mount and Unmount (4 tests): Verifies component mounts without canvas dependency failures, proper cleanup on unmount, ref clearing, and requestAnimationFrame cancellation
Series Updates (3 tests): Tests price data fetching on mount, empty data handling, and series creation with chart
Subscribe/Unsubscribe Behavior (4 tests): Validates socket price update subscriptions/unsubscriptions and window resize event listener management
Offline Badge Behavior (4 tests): Confirms LIVE/OFFLINE badge display and ConnectionStatus component visibility based on connection state
Error Handling (2 tests): Tests API error handling and loading state display
Chart Configuration (3 tests): Verifies chart creation with correct configuration, line series options, and custom height prop usage
Key Implementation:

Mocked lightweight-charts library to avoid real canvas dependencies
Mocked api-client, socket service, and useConnectionStatus hook
Implemented synchronous requestAnimationFrame mock for immediate execution
All cleanup assertions verify proper resource disposal on unmount
Acceptance Criteria Met:

✓ No real canvas dependency failures
✓ Cleanup on unmount asserted
✓ Subscribe/unsubscribe behavior tested
✓ Offline badge behavior tested
Closes #333

@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

@jotel-dev is attempting to deploy a commit to the josephchimebuka's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

Add PriceChart component tests for mount and series updates

2 participants