[Test] UI Dashboard - Add unit tests for 5 untested files#23773
Merged
yuneng-jiang merged 1 commit intolitellm_yj_march_16_2026from Mar 16, 2026
Merged
[Test] UI Dashboard - Add unit tests for 5 untested files#23773yuneng-jiang merged 1 commit intolitellm_yj_march_16_2026from
yuneng-jiang merged 1 commit intolitellm_yj_march_16_2026from
Conversation
Tests added for: UiLoadingSpinner, HashicorpVaultEmptyPlaceholder, PageVisibilitySettings, errorUtils, and mcpToolCrudClassification. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile SummaryThis PR adds 26 Vitest unit tests across 5 previously-untested files in the Key highlights:
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/utils/errorUtils.test.ts | Adds 7 tests covering all branches of extractErrorMessage: Error instances, string detail, FastAPI 422 array, nested detail object, message fallback, JSON.stringify fallback, and primitives. Tests align correctly with the source implementation. |
| ui/litellm-dashboard/src/utils/mcpToolCrudClassification.test.ts | Adds 7 tests for classifyToolOp (read/delete/create/update classification, READ-over-DELETE priority, description fallback, unknown fallback) and 1 test for groupToolsByCrud. All assertions match the regex-based implementation. |
| ui/litellm-dashboard/src/components/ui/ui-loading-spinner.test.tsx | Adds 3 tests for UiLoadingSpinner covering SVG rendering, className merging with animate-spin, and prop spreading (aria-label). The document.getAnimations polyfill in setupTests.ts ensures the useSafeLayoutEffect hook won't throw in jsdom. |
| ui/litellm-dashboard/src/components/Settings/AdminSettings/HashicorpVault/HashicorpVaultEmptyPlaceholder.test.tsx | Adds 3 tests checking empty-state text, button click triggering onAdd callback, and description paragraph rendering. All role/text queries match the actual Ant Design component output. |
| ui/litellm-dashboard/src/components/Settings/AdminSettings/UISettings/PageVisibilitySettings.test.tsx | Adds 5 tests covering the null/set tag display, page count (singular/plural), collapse expand + reset button callback, and optional description rendering. The mock for getAvailablePages is correct, and findByRole is used appropriately for async Collapse expansion. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph "New Test Files"
T1[errorUtils.test.ts\n7 tests]
T2[mcpToolCrudClassification.test.ts\n8 tests]
T3[ui-loading-spinner.test.tsx\n3 tests]
T4[HashicorpVaultEmptyPlaceholder.test.tsx\n3 tests]
T5[PageVisibilitySettings.test.tsx\n5 tests]
end
subgraph "Source Under Test"
S1[errorUtils.ts\nextractErrorMessage]
S2[mcpToolCrudClassification.ts\nclassifyToolOp / groupToolsByCrud]
S3[ui-loading-spinner.tsx\nUiLoadingSpinner SVG]
S4[HashicorpVaultEmptyPlaceholder.tsx\nAnt Design Empty + Button]
S5[PageVisibilitySettings.tsx\nAnt Design Collapse + Checkbox.Group]
end
subgraph "Global Test Setup"
SETUP[tests/setupTests.ts\ngetAnimations polyfill\nmatchMedia mock\nResizeObserver stub\nAnt Design / Tremor mocks]
end
T1 -->|imports| S1
T2 -->|imports| S2
T3 -->|imports| S3
T4 -->|imports| S4
T5 -->|imports + mocks page_utils| S5
SETUP -.->|applied to all tests| T1
SETUP -.->|applied to all tests| T2
SETUP -.->|applied to all tests| T3
SETUP -.->|applied to all tests| T4
SETUP -.->|applied to all tests| T5
Last reviewed commit: 5d33cc6
eba8df5
into
litellm_yj_march_16_2026
44 of 65 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Vitest unit tests for 5 previously untested files in the
ui/litellm-dashboardfolder:UiLoadingSpinner- SVG rendering, className merging, prop spreadingHashicorpVaultEmptyPlaceholder- empty state rendering, button click callbackPageVisibilitySettings- conditional tag rendering, collapse interaction, reset callbackerrorUtils- all error shape branches (Error, string detail, FastAPI 422 array, nested object, fallbacks)mcpToolCrudClassification- CRUD classification by name, description fallback, groupingTesting
All 26 tests pass locally via
npx vitest run.Type
✅ Test