Daily Test Coverage Improver - Add tests for useVariantConfigs hook #5147
+159
−0
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.
Goal and Rationale
This PR adds comprehensive unit tests for the
useVariantConfigs.tshook (exported asuseRuntimeEnvVarConfigs), which was previously untested (0% coverage).Coverage area chosen: Simple utility hook in
/react/src/hooks/useVariantConfigs.tsWhy it matters: This hook provides runtime environment variable configurations for model services (vLLM, SGLang, NIM). Testing it ensures:
Approach
Testing strategy:
renderHookreact-i18nextto isolate translation logicImplementation steps:
Impact Measurement
Test Coverage Results
Test Suite Results
Trade-offs
What changed:
react/src/hooks/useVariantConfigs.test.ts(159 lines)Complexity:
Validation
Testing approach:
Success criteria met:
✅ All 11 new tests pass
✅ 100% coverage achieved for useVariantConfigs.ts
✅ No existing tests broken
✅ Hooks coverage improved by 0.19-0.23%
✅ Overall React coverage improved by 0.02%
Test Cases Covered
Future Work
Additional coverage opportunities identified:
Based on the baseline coverage analysis and previous PR recommendations, the next priority areas are:
More Simple Utility Hooks (0% coverage, high ROI):
useHighlight.ts- Code syntax highlighting with shikiuseKeyboardShortcut.ts- Keyboard event handlinguseScrollBreackPoint.tsx- Scroll position trackingValidation Hooks (important business logic):
useValidateServiceName.tsx- Service name validationuseValidateSessionName.tsx- Session name validationState Management Hooks:
useLocalStorageGlobalState.tsx- Browser storage hookuseHiddenColumnKeysSetting.tsx- UI settings persistenceBackend.AI UI Package (
packages/backend.ai-ui/src/helper/index.ts):Reproducibility
Setup Commands
Run Tests
Measurement Procedures
Expected Results Format
Related: Discussion #4760 - Daily Test Coverage Improver Research and Plan