[Test Improver] Add unit tests for useInterval composable - #18723
Merged
nwmac merged 1 commit intoAug 7, 2026
Conversation
Cover all branches of the useInterval composable: - interval starts after mount and fires at correct delay - interval is cleared on beforeUnmount (no leaks) - multiple independent instances do not interfere 0% → 100% statements/branches/functions/lines Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nwmac
approved these changes
Aug 7, 2026
nwmac
marked this pull request as ready for review
August 7, 2026 12:20
nwmac
deleted the
test-assist/use-interval-composable-tests-4b39639bcf56fc09
branch
August 7, 2026 16:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated PR from Test Improver, an AI-powered test improvement assistant.
Goal and Rationale
Add tests for
shell/composables/useInterval.ts— a lifecycle-awaresetIntervalwrapper used across the dashboard. This composable had zero test coverage despite containing meaningful behavior:onMountedonBeforeUnmount(preventing memory leaks)Approach
Tests mount a minimal component that calls
useInterval, usingjest.useFakeTimers()to control time precisely without flakiness. 6 tests cover:Coverage Impact
Test Status
✅ All 6 tests pass, no linting warnings.
Trade-offs
jest.useFakeTimers()/useRealTimers()used per test to avoid timer bleed.Fixes #
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
download.cypress.ioSee Network Configuration for more information.