feat(admin-ui): add test files for all standalone components across the system#2912
Conversation
…he system (#2896) Signed-off-by: faisalsiddique4400 <faisalsiddique10886@gmail.com>
Signed-off-by: faisalsiddique4400 <faisalsiddique10886@gmail.com>
|
Warning Review limit reached
Next review available in: 11 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughAdds Jest/React Testing Library test files for approximately 30 UI components, hooks, context providers, route pages, and utility modules across ChangesTest Coverage Additions
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 11
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@admin-ui/app/components/GluuPageContent/__tests__/GluuPageContent.test.tsx`:
- Around line 40-49: The no-maxWidth test only verifies child text rendering and
does not protect the intended DOM shape. Tighten the existing GluuPageContent
test so it asserts the no-maxWidth branch in GluuPageContent directly, using the
component’s rendered container/inner wrapper behavior to confirm children are
mounted without the extra wrapper that appears when maxWidth is set.
In `@admin-ui/app/components/Layout/__tests__/LayoutNavbar.test.tsx`:
- Around line 32-42: The LayoutNavbar test currently leaves the console.error
spy unrestored if the render assertion throws before cleanup runs. Update the
test around the LayoutNavbar "throws when given more than one child" case so the
spy is always restored, either by wrapping the expect(render(...)).toThrow()
call in a try/finally or by moving the mock cleanup into an afterEach hook for
this test file.
In `@admin-ui/app/components/SidebarMenu/__tests__/SidebarMenuItem.test.tsx`:
- Around line 81-90: The active-state test is not exercising the active branch
because the mocked entries key does not match the generated entry id and the
assertion only checks the always-present structural class. Update the
SidebarMenuItem test to use a matching entry id in the renderItem entries mock
so the component resolves an active entry, then assert the active class behavior
via sidebarMenuActiveClass on the rendered li instead of only checking
sidebar-menu__entry.
In `@admin-ui/app/context/theme/__tests__/config.test.ts`:
- Line 8: The ThemeConfig tests are using identity checks that are too strict;
update the assertions in config.test.ts to avoid relying on object reuse from
themeConfig. Replace the toBe/not.toBe expectations around getThemeColor()
results with toEqual, toMatchObject, or field-level assertions so the tests
still pass if configs are cloned while preserving the same values.
In `@admin-ui/app/context/theme/__tests__/themeContext.test.tsx`:
- Around line 42-49: The theme context test is hardcoding the localStorage key
instead of using the shared storage key constant, so update the assertion in
themeContext.test.tsx to reference STORAGE_KEYS.INIT_THEME alongside useTheme
and THEME_LIGHT. This keeps the test aligned with the provider’s storage
contract and avoids duplicating the key value in the test.
In `@admin-ui/app/routes/Apps/Gluu/__tests__/GluuText.test.tsx`:
- Around line 38-46: The GluuText test only checks that some inline color is
set, which can miss regressions in the actual theme mapping. Update the test in
GluuText.test.tsx so it asserts the exact expected theme color used by GluuText,
ideally by reading the same theme source or token that AppTestWrapper provides,
and compare the element style against that specific value instead of just
checking it is non-empty.
In `@admin-ui/app/routes/Apps/Gluu/__tests__/ThemeDropdown.test.tsx`:
- Around line 54-60: The ThemeDropdown tests are hardcoding the persistence key
instead of using the shared storage contract. Update the assertions in
ThemeDropdown.test.tsx to reference STORAGE_KEYS.USER_CONFIG, matching the key
used by ThemeDropdown for reading and writing userConfig so the tests stay
aligned if the constant changes.
In `@admin-ui/app/routes/Apps/Gluu/components/__tests__/UserIcon.test.tsx`:
- Around line 16-28: The UserIcon tests only assert that a fallback image
exists, but they should verify the exact shared fallback value. Update the tests
around UserIcon to compare the rendered img src against DEFAULT_AVATAR_URL when
avatarUrl is null and after fireEvent.error(img), so the contract is checked
precisely instead of allowing any non-empty placeholder.
In `@admin-ui/app/routes/Apps/Profile/__tests__/ProfilePage.test.tsx`:
- Around line 134-141: The missing-surname test in ProfilePage is only verifying
the section renders, so it does not actually protect the dash fallback behavior.
Update the existing test around renderPage and screen.getByText to assert the
surname row shows a dash when mockUseProfileDetails returns surname as
undefined, using the ProfilePage rendering path and the personal information
labels to locate the exact row.
In `@admin-ui/app/routes/Dashboards/Chart/__tests__/TooltipDesign.test.tsx`:
- Around line 28-34: Update the TooltipDesign test so it asserts the mapped
label produced by the labelMap branch in renderTooltip, not just the payload
value; the current getByText(/42/) check in the “renders a mapped label with its
value when active” case can pass even if the "mau" mapping breaks. Use the
existing renderTooltip helper and TooltipDesign/labelMap-related output to
verify the translated label text appears alongside the value, so a regression in
the mau mapping is caught.
In `@admin-ui/app/utils/__tests__/tooltipManager.test.ts`:
- Around line 11-13: The tooltipManager test cleanup only clears the DOM, but
the module-level registry and listening state in tooltipManager.ts can still
leak between cases. Update the shared test cleanup in afterEach to also dispose
any registered tooltip listeners and reset tooltipManager state, using the
tooltipManager helpers and the listener disposer references used by the tests so
leaked callbacks cannot survive failed expectations.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 78f9966d-6708-41db-a67d-9da30b79e95e
📒 Files selected for processing (35)
admin-ui/app/components/Card/__tests__/Card.test.tsxadmin-ui/app/components/CardHeader/__tests__/CardHeader.test.tsxadmin-ui/app/components/GluuPageContent/__tests__/GluuPageContent.test.tsxadmin-ui/app/components/GluuSpinner/__tests__/GluuSpinner.test.tsxadmin-ui/app/components/Layout/__tests__/LayoutNavbar.test.tsxadmin-ui/app/components/Notifications/__tests__/Notifications.test.tsxadmin-ui/app/components/SidebarMenu/__tests__/SidebarMenuItem.test.tsxadmin-ui/app/components/Wizard/__tests__/WizardStep.test.tsxadmin-ui/app/context/theme/__tests__/config.test.tsadmin-ui/app/context/theme/__tests__/themeContext.test.tsxadmin-ui/app/helpers/__tests__/navigation.test.tsadmin-ui/app/routes/Apps/Gluu/__tests__/Gluu404Error.test.tsxadmin-ui/app/routes/Apps/Gluu/__tests__/GluuInfo.test.tsxadmin-ui/app/routes/Apps/Gluu/__tests__/GluuLoader.test.tsxadmin-ui/app/routes/Apps/Gluu/__tests__/GluuStatusMessage.test.tsxadmin-ui/app/routes/Apps/Gluu/__tests__/GluuText.test.tsxadmin-ui/app/routes/Apps/Gluu/__tests__/ThemeDropdown.test.tsxadmin-ui/app/routes/Apps/Gluu/components/__tests__/UserIcon.test.tsxadmin-ui/app/routes/Apps/Gluu/hooks/__tests__/useNavbarTheme.test.tsadmin-ui/app/routes/Apps/Gluu/hooks/__tests__/usePageTitle.test.tsadmin-ui/app/routes/Apps/Profile/__tests__/ProfilePage.test.tsxadmin-ui/app/routes/Dashboards/Chart/__tests__/TooltipDesign.test.tsxadmin-ui/app/routes/Dashboards/components/__tests__/StatusIndicator.test.tsxadmin-ui/app/routes/Dashboards/components/__tests__/UserInfoItem.test.tsxadmin-ui/app/routes/components/Dropdowns/__tests__/DropdownProfile.test.tsxadmin-ui/app/routes/components/LogoThemed/__tests__/LogoThemed.test.tsxadmin-ui/app/routes/components/Pages/__tests__/FooterAuth.test.tsxadmin-ui/app/routes/components/Pages/__tests__/HeaderAuth.test.tsxadmin-ui/app/routes/components/__tests__/FooterText.test.tsxadmin-ui/app/utils/__tests__/customColors.test.tsadmin-ui/app/utils/__tests__/logLevel.test.tsadmin-ui/app/utils/__tests__/storage.test.tsadmin-ui/app/utils/__tests__/tooltipManager.test.tsadmin-ui/plugins/admin/components/Webhook/__tests__/WebhookURLChecker.test.tsadmin-ui/plugins/user-management/common/__tests__/Constants.test.ts
Signed-off-by: faisalsiddique4400 <faisalsiddique10886@gmail.com>
|



feat(admin-ui): add test files for all standalone components across the system (#2896)
Summary
This PR expands the Admin UI test suite by adding test files for standalone components that previously had no dedicated test coverage.
The goal is to improve confidence in reusable UI components, reduce regression risk, and strengthen the overall Jest test suite by ensuring standalone components are independently validated across the application.
Fix Summary
Verification
passes successfully.
🔗 Ticket
Closes: #2896
Summary by CodeRabbit