[Test Improver] Add unit tests for uiplugins.ts onExtensionsReady, getLatestExtensionVersion, installHelmChart - #18890
Merged
Conversation
…sionVersion, installHelmChart Add 14 new unit tests for three previously untested functions in shell/utils/uiplugins.ts: - onExtensionsReady: tests for early-return (already ready), dispatch setReady on completion, onLogIn called for each plugin, error resilience (onLogIn throws), and null plugins getter - getLatestExtensionVersion: tests for first-compatible-version selection, no compatible versions, missing chart, and custom dispatch options - installHelmChart: tests for default install action, upgrade action, custom namespace, annotation content, and custom values passthrough Coverage: statements 34%→55%, branches 100% (no change), functions 15%→38% Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nwmac
approved these changes
Aug 21, 2026
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.
🤖 This is an automated PR from Test Improver, an AI assistant for improving test coverage.
Goal
Add unit tests for three previously untested exported functions in
shell/utils/uiplugins.ts. These functions handle extension loading, Helm chart version lookup, and Helm chart installation — all part of the UI Plugin system critical path.Approach
onExtensionsReady: Test early-return when already ready, dispatch ofsetReadyon completion, sequentialonLogIncalls per plugin, error resilience when a plugin'sonLogInthrows, and graceful handling of anullplugins getter.getLatestExtensionVersion: Test first-compatible-version selection (skipping incompatible), no-compatible-versions path, missing chart path, and custom dispatch options.installHelmChart: Test defaultinstallaction,upgradeaction override, custom namespace, annotation content from chart metadata, and customvaluespassthrough.All three functions are mocked cleanly with no real network/store I/O.
Coverage Impact
(Remaining uncovered functions involve complex async polling loops with retries —
waitForUIExtension,waitForUIPackage,createHelmRepository,getHelmChart,refreshHelmRepository,getHelmRepository*— which would require fake timers and intricate mock sequencing; left for a follow-up.)Test Status
✅ 14/14 tests pass
✅ Lint clean (
eslint --max-warnings 0)Reproducibility
yarn test:ci shell/utils/__tests__/uiplugins-extra.test.ts # or: node_modules/.bin/jest --no-coverage shell/utils/__tests__/uiplugins-extra.test.tsFixes: N/A (new tests)
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
download.cypress.ioSee Network Configuration for more information.