Skip to content

[Test Improver] Add unit tests for uiplugins store - #69

Draft
github-actions[bot] wants to merge 1 commit into
masterfrom
test-assist/uiplugins-store-7da06d7a2daee296
Draft

[Test Improver] Add unit tests for uiplugins store#69
github-actions[bot] wants to merge 1 commit into
masterfrom
test-assist/uiplugins-store-7da06d7a2daee296

Conversation

@github-actions

Copy link
Copy Markdown

🤖 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/uiplugins.ts. This store manages UI plugin registration (add, remove, track load errors, readiness). It had zero test coverage despite the removePlugin mutation containing meaningful index-search-and-splice logic worth protecting.

Approach

  • Imported state, getters, and mutations directly from the store module
  • Used a minimal PluginStub interface ({ name: string }) cast as Plugin to avoid constructing the full class
  • Exercised all four mutations and the state factory; skipped trivial pass-through actions (one-line commit() wrappers)

Tests written (19 total):

Group Cases
state empty plugins array, empty errors object, ready=false, fresh copy per call
getters plugins, errors, ready return corresponding state slices
mutations.setError new entry, falsy value, overwrites existing, distinct names
mutations.addPlugin append to empty list, append to existing list
mutations.removePlugin removes match, no-op when absent, removes only matching entry, removes first duplicate
mutations.setReady set true, set false

Coverage Impact

New file: shell/store/__tests__/uiplugins.test.ts (19 tests). The uiplugins store module was previously uncovered.

Trade-offs

  • Actions (setError, addPlugin, removePlugin, setReady) omitted — all are one-line commit() wrappers with no branching logic.

Reproducibility

YARN_IGNORE_ENGINES=true NODE_OPTIONS=--max_old_space_size=8192 yarn test:ci --testPathPattern=shell/store/__tests__/uiplugins

Test Status

✅ All 19 tests pass. ESLint reports no warnings.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • download.cypress.io

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "download.cypress.io"

See Network Configuration for more information.

Generated by Daily Test Improver · ● 1.8M ·

Cover state factory, all mutations (setError, addPlugin,
removePlugin, setReady) and pass-through getters.

Notable cases:
- removePlugin: no-op when name absent, removes only first
  duplicate match, removes mid-list entry without disturbing others
- setError: overwrites existing entries, stores falsy values

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants