[Test Improver] Add unit tests for wm store (window manager) - #57
Draft
github-actions[bot] wants to merge 1 commit into
Draft
[Test Improver] Add unit tests for wm store (window manager)#57github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Cover state factory, getters, mutations, and actions for the window manager Vuex store: - state factory: reads panelHeight/panelWidth from localStorage on initialisation, defaults tabs/active/open/lockedPositions to empty collections, userPin to null - getters: byId (hit/miss), tabs, isOpen, panelWidth, panelHeight, userPin, lockedPositions - mutations.addTab: deduplication, position fallback (localStorage pin / BOTTOM), lockedPositions forced BOTTOM, default layouts/showHeader, active+open+userPin state updates, localStorage.setItem - mutations.switchTab: position move, target-position active/open update, old-position cleanup (no remaining tabs → active='' + open=false), remaining tab promoted to active, userPin + localStorage.setItem - mutations.closeTab: removal, active-tab promotion, open cleared when no remaining tabs, early return for non-existent id - mutations.removeTab: simple removal and no-op for unknown tab - mutations.setOpen/setActive: setter correctness - mutations.setPanelHeight/setPanelWidth: value update, localStorage persistence, containerHeight/containerWidth propagation to tabs - mutations.setUserPin/setLockedPositions: state + localStorage side effects - actions.close: throws on missing id, commits closeTab - actions.open: throws on missing tab.id, commits addTab 58 tests total, all passing. ESLint clean. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
26 tasks
21 tasks
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 PR was created by Test Improver, an automated AI assistant focused on improving test coverage.
Goal and Rationale
Add unit tests for
shell/store/wm.ts— the Vuex store powering the window manager panel (tabs, positions, pinning, dimensions). This store has zero existing test coverage despite containing complex, conditional logic for:addTablocalStorage(pin key) when no position is suppliedlockedPositionsis setswitchTabandcloseTablocalStoragepersistence for panel dimensions and pin preferencesopenandcloseactionsApproach
Direct mutation/getter/action calls against a plain state object — no full Vuex store needed, matching the pattern used in
cookies.test.tsandcatalog.test.ts.window.localStorageis replaced with a per-test in-memory mock (same pattern asdynamic-content/__tests__/index.test.ts) sosetItem/getItemcalls can be asserted without touching disk state.Layoutconst-enum values are referenced as their underlying string literals ('default','home') to avoidisolatedModulesconst-enum inlining issues at test time.Coverage Impact
58 new tests, zero pre-existing tests modified.
Trade-offs
createStore. This is intentional: it keeps tests fast, focused, and free of Vuex plumbing noise. The store module's logic is self-contained.state()factory'slocalStorage.getItemcalls are exercised by the localStorage mock — no special initialisation tricks required.Reproducibility
Test Status
✅ 58 / 58 tests pass
✅ ESLint clean (
--max-warnings 0)✅ No pre-existing tests broken
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
download.cypress.ioSee Network Configuration for more information.