[Test Improver] Add unit tests for projectAndNamespaceFiltering.utils - #109
Draft
github-actions[bot] wants to merge 1 commit into
Draft
[Test Improver] Add unit tests for projectAndNamespaceFiltering.utils#109github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Add 25 unit tests for `projectAndNamespaceFiltering.utils.ts`: - isApplicable: 5 cases — array (empty/non-empty), undefined, string-typed namespaced, and absent property - isEnabled: 6 cases — happy path, wrong inStore, workspace switcher enabled, forceNsFilterV2 disabled, default perf settings (disabled), null currentProduct - createParam: 10 cases — undefined/empty input, plain namespace, ns:// prefix strip, project:// prefix strip, multi-include join, mixed-prefix join, single/multi exclude with leading dash, exclude-overrides-include precedence - checkAndCreateParam: 4 cases — non-array opt, empty array, populated array, ns:// prefix stripping Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Jun 30, 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 PR was created by Test Improver, an automated AI assistant focused on improving test coverage.
Goal and Rationale
shell/plugins/steve/projectAndNamespaceFiltering.utils.tshad no test coverage. It implements namespace/project filtering logic for the Steve API store — controlling which resources are fetched from specific namespaces/projects via theprojectsornamespacesquery parameter. ThecreateParamfunction has non-trivial branching: prefix stripping (ns://,project://), include vs. exclude handling (leading-), and multi-value join logic.isEnabledguards behind three separate conditions (store type, workspace switcher, feature flag).Approach
isApplicable(5 tests): verifies Array detection foropt.namespaced— empty array, populated array, undefined, string, absent property.isEnabled(6 tests): mocksrootGetterswithcurrentProductandmanagement/byIdreturning a perf setting. Covers happy path plus each early-return condition (wronginStore,showWorkspaceSwitcher,forceNsFilterV2disabled, default settings, null product).createParam(10 tests): covers undefined/empty input, plain namespace,ns://prefix strip,project://prefix strip, multi-include join, mixed-prefix join, single/multi exclude with leading dash, and the precedence rule that exclude overwrites include when both are present.checkAndCreateParam(4 tests): end-to-end delegation — non-array opt returns'', empty array returns'', populated array produces the query param, prefix stripping works.Coverage Impact
25 tests added. All branches in
createParam,isApplicable, andcheckAndCreateParamcovered;isEnabledcovers all 4 branches.Trade-offs
rootGettersinline — consistent with existing patterns insettings.test.ts.Reproducibility
YARN_IGNORE_ENGINES=true NODE_OPTIONS=--max_old_space_size=8192 yarn test:ci --testPathPattern='projectAndNamespaceFiltering.utils.test.ts'Test Status
✅ All 25 tests pass. ESLint: 0 warnings.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
download.cypress.ioSee Network Configuration for more information.