test(settings): backfill unit tests for team / billing / notifications panels (#1870)
Closes #1870
Summary
Issue #1870 — group 2 of the i18n coverage gap.
PR #1518 (Chinese i18n) surfaced a pre-existing testing gap: many settings panels had zero test files. This PR addresses the team / billing / notifications subset called out in the issue's suggested decomposition.
Adds per-component RTL + Vitest suites for 8 panels:
| Panel | Tests | Coverage focus |
|---|---|---|
BillingPanel |
4 | auto-open flow, error state, re-open click, back navigation |
NotificationsPanel |
6 | DND skeleton/toggle/rollback, per-category toggles, redux preference seeding |
NotificationRoutingPanel |
6 | pipeline stats card, per-provider load + retry hint, threshold formatting, payload shape |
MessagingPanel |
5 | default-channel selector, loading + error, ChannelSetupModal open/close, updatePreferences wiring |
TeamPanel |
8 | list/active badge, create/join/switch/leave, manage navigation, localized error fallback |
TeamMembersPanel |
7 | admin vs. non-admin affordances, role-change + remove confirmations, empty state, route-context teamId |
TeamInvitesPanel |
6 | code rendering with state badges, generate/revoke/copy, admin gating, empty state |
TeamManagementPanel |
8 | admin-only entry, not-found + access-denied branches, sub-route navigation, edit-name + delete confirm |
50 new tests total. Behavior-focused per the in-repo convention — exercising RPC payload shapes, modal confirmation flows, optimistic-UI rollback, and i18n-resolved labels rather than implementation details.
Test plan
- [x]
pnpm test src/components/settings/panels— 230/230 pass across 26 files - [x]
pnpm compile— clean - [x] ESLint clean on the 8 new files
- [x] Prettier applied
Remaining work (tracked separately)
Per #1870, groups 3–5 are still untested and will land as separate PRs:
- Group 3: debug panels (
MemoryDebugPanel,VoiceDebugPanel,WebhooksDebugPanel,LocalModelDebugPanel,ScreenAwarenessDebugPanel,AutocompleteDebugPanel) - Group 4: top-level pages (
Accounts,Conversations,Intelligence,Invites,Notifications,Webhooks) - Group 5: onboarding (
BetaBanner,ChatProviderPage,ReferralApplyStep)
Summary by CodeRabbit
- Tests
- Added comprehensive test coverage for settings panels including billing, messaging, notifications, notification routing, and team management
- Verified settings panel functionality across navigation flows, data operations, and error handling to ensure reliability and stability
This PR adds comprehensive test suites for eight settings panel components: Billing, Messaging, NotificationRouting, Notifications, TeamInvites, TeamManagement, TeamMembers, and TeamPanel. Tests verify UI rendering, user interactions, async state flows, and API integration using mocked dependencies and React Testing Library assertions. Settings Panels Test Coverage 🎯 3 (Moderate) | ⏱️ ~25 minutes 🐰 Eight panels tested end to end,
With mocks and flows that always blend,
Billing, messaging, notifications too,
Teams and invites—all tried and true!
From billing dashes to team embrace,
Coverage blooms in every place. ✨ ✏️ Tip: You can configure your own custom pre-merge checks in the settings.📝 Walkthrough
Walkthrough
Changes
Layer / File(s)
Summary
Billing and Messaging Panel Tests
app/src/components/settings/panels/BillingPanel.test.tsx, app/src/components/settings/panels/MessagingPanel.test.tsxBillingPanel tests verify mount-time
openUrl calls, button interactions, and navigation. MessagingPanel tests validate loading/error states, channel selector rendering, modal open/close, and API calls for setting default channels. Both mock navigation hooks and external dependencies.
Notification Settings Panel Tests
app/src/components/settings/panels/NotificationRoutingPanel.test.tsx, app/src/components/settings/panels/NotificationsPanel.test.tsxNotificationRoutingPanel tests verify stats card rendering, provider threshold display, toggle interactions, and per-provider error states. NotificationsPanel tests validate category and DND toggles, optimistic updates, rollback on failure, and Redux preference mapping. Both mock notification services and provide Redux store builders.
Team Management Panel Tests
app/src/components/settings/panels/TeamPanel.test.tsx, app/src/components/settings/panels/TeamManagementPanel.test.tsx, app/src/components/settings/panels/TeamMembersPanel.test.tsx, app/src/components/settings/panels/TeamInvitesPanel.test.tsxTeamPanel tests cover team list rendering, create/join/leave/switch flows, manage navigation, and error handling. TeamManagementPanel tests verify settings/deletion modals and sub-route navigation. TeamMembersPanel tests validate member rendering, role-change/remove confirmation flows, and admin-gating. TeamInvitesPanel tests verify invite generation, revocation, copy-to-clipboard, and empty states. All use mocked team API and core state provider with fixture builders.
Estimated code review effort
Possibly related issues
#1870: This PR directly addresses test coverage for the untested settings panel components referenced in the issue backfill.Suggested labels
workingSuggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name
Status
Explanation
Resolution
Docstring Coverage
⚠️ Warning
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.
Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name
Status
Explanation
Description Check
✅ Passed
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
✅ Passed
The title accurately summarizes the main change: adding unit tests for multiple settings panels (team, billing, notifications). It's concise, clear, and directly reflects the changeset.
Linked Issues check
✅ Passed
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
✅ Passed
Check skipped because no linked issues were found for this pull request.
[!WARNING] There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
🔧 ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add
eslintto devDependencies.
Comment @coderabbitai help to get the list of available commands and usage tips.