Skip to content

[Test Improver] Add unit tests for growl store - #85

Draft
github-actions[bot] wants to merge 1 commit into
masterfrom
test-assist/growl-store-b8d8347440f4dd47
Draft

[Test Improver] Add unit tests for growl store#85
github-actions[bot] wants to merge 1 commit into
masterfrom
test-assist/growl-store-b8d8347440f4dd47

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/growl.js. The growl store manages transient notification banners and contains non-trivial logic that was completely untested:

  • add mutation — enforces a MAX_GROWLS = 5 cap (evicts the oldest on overflow) and prepends new items with an auto-incremented id and a timestamp
  • close action — conditionally dispatches notifications/markRead only when the growl carries a linked notification id
  • notification action — maps NotificationLevel values to color/icon pairs and skips levels that don't warrant a growl (Announcement, Task, Info, Hidden)

These rules are easy to break accidentally — the tests codify and guard them.

Approach

  • Unit-test state factory, find/byId getters, all three mutations, and the close/notification actions
  • Mutations are called directly against a plain state object (no Vuex store needed)
  • Actions are tested by injecting { commit, dispatch, getters } mocks
  • notification action uses it.each to cover all four skipped levels and all three committed levels

Coverage Impact

File Before After
shell/store/growl.js 0% ~90% statements

Test Status

✅ 25 tests pass, 0 failures, 0 lint warnings

PASS shell/store/__tests__/growl.test.ts
Tests: 25 passed, 25 total

Reproducibility

yarn test:ci --testPathPattern='shell/store/__tests__/growl.test.ts'

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 · ● 2.4M ·

Add 25 unit tests covering state factory, getters (find, byId),
mutations (add, remove, clear), and actions (close, notification)
for shell/store/growl.js.

Highlights:
- add mutation: MAX_GROWLS=5 overflow → oldest item evicted
- close action: conditional notifications/markRead dispatch
- notification action: NotificationLevel → color/icon mapping,
  skip for Announcement/Task/Info/Hidden levels

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