Skip to content

Conversation

@VetteIT
Copy link
Contributor

@VetteIT VetteIT commented Oct 7, 2025

Description

Add a focused suite of unit tests for ErrorModal covering modal wiring, i18n rendering, external link attributes, refresh behavior, and basic a11y attributes. Tests are written with Vitest + @testing-library/react and follow the style used in recent PRs.

Closes #113

What change does this PR introduce?

  • Test coverage for ErrorModal
  • Bug fix
  • New feature
  • Breaking change
  • CI/CD
  • Documentation update
  • Chore

Proposed approach

  • Mock react-i18next to return i18n keys as fallback text.
  • Mock useGlobalModal to assert setPromptError(null) is called on close.
  • Mock MUI Modal to inspect the props passed by the component.
  • Verify:
    • open and aria-labelledby are correctly set.
    • Title, error message, and InfoIcon render.
    • Discord link uses the URL from Endpoints and has target="_blank" + rel="noopener noreferrer".
    • window.location.reload is invoked from the Refresh button when the jsdom environment supports spying; otherwise the click is asserted to be safe (no throw).
    • The heading id matches aria-labelledby for basic a11y.

Checklist

  • Commit message follows Conventional Commits
  • Tests added/updated for the new cases
  • No app logic changed; test-only changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] Add unit test cases for ErrorModal component

1 participant