[Test Improver] test: add unit tests for gc-root-store.js#17806
Draft
github-actions[bot] wants to merge 2 commits into
Draft
[Test Improver] test: add unit tests for gc-root-store.js#17806github-actions[bot] wants to merge 2 commits into
github-actions[bot] wants to merge 2 commits into
Conversation
Add 15 unit tests covering gcGetters.gcStores and all gcActions: - gcPreferencesUpdated (3 cases: enabled, disabled-was-on, disabled-was-off) - gcRouteChanged, gcStartIntervals, gcStopIntervals (delegation) - gcResetStores (dispatch for each store, empty stores) - garbageCollect (enabled/disabled setting, empty stores) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
🤖 Test Improver — automated AI assistant
Goal and Rationale
shell/utils/gc/gc-root-store.jshad zero test coverage. It provides the Vuex getters and actions that coordinate garbage collection across all registered stores. While adjacent files (gc.ts,gc-interval.ts,gc-route-changed.ts) already have tests, the root store orchestration layer was untested.Approach
gcGetters.gcStores— pure getter: 4 tests covering multi-store results, no-match, primitive state entries (skipped), and empty state.gcActions.gcRouteChanged/gcStartIntervals/gcStopIntervals— delegation tests: verify each action calls the correct underlying module with the expected arguments.gcActions.gcResetStores— 2 tests: dispatches per-store reset for each gc-enabled store, and dispatches nothing when no stores.gcActions.garbageCollect— 3 tests: dispatches per-store gc when setting enabled, no dispatch when disabled, no dispatch when no stores.gcActions.gcPreferencesUpdated— 3 tests: enables (start intervals), disables-was-on (reset stores), disables-was-off (only stop intervals).All dependencies (
gc,gc-interval,gc-route-changed) are mocked viajest.resetModules()+jest.mock()per the existing gc test pattern.Coverage Impact
Test Status
All 15 tests pass. ESLint reports no warnings.
Trade-offs
Simple dispatch-mock tests. Minimal maintenance burden since they follow the same pattern as existing gc tests.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
download.cypress.ioSee Network Configuration for more information.