test(scientific): make heatmap selection-clear test deterministic - #38
Conversation
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideMakes the flaky Sequence diagram for deterministic useHeatmap selection-clear testsequenceDiagram
participant Test as useHeatmap_test
participant Hook as useHeatmap
participant React as ReactEffects
Test->>Hook: renderHook(loader)
React->>Hook: run_effects_on_dataset_load
Test->>Hook: waitFor(status === success)
Test->>React: act(async {})
React->>Hook: flush_pending_effects
Test->>Hook: selectCell(key)
Test->>Hook: waitFor(selectedKey === key)
Test->>Hook: refetch()
React->>Hook: run_effects_on_dataset_load
Test->>Hook: waitFor(selectedKey === null)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important Review available on request
Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixes the flaky CI test
useHeatmap > clears the selection when a new dataset loads(failed on run #105 of the #37 merge).Root cause:
useHeatmapclears the selection in auseEffectwhenever a new dataset id loads. After the initial success render, that effect runs asynchronously and could clear the selection after the test's manualselectCell, racing the intermediate assertion.Fix: flush pending effects with
await act(async () => {})right after waiting forsuccess, before selecting a cell — the same pattern already used in the equivalentuseNetworkViewer/useProteinViewertests — and assert the exact selected key.Verification: 15/15 full-file runs + 725/725 web suite, lint, typecheck, build all green.
Summary by Sourcery
Tests:
useHeatmapselection-clear test deterministic by flushing effects before selecting a cell and asserting the specific selected key.