[Test Improver] Add unit tests for useRuntimeFlag composable - #49
Draft
github-actions[bot] wants to merge 1 commit into
Draft
[Test Improver] Add unit tests for useRuntimeFlag composable#49github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
8 table-driven tests covering featureDropdownMenu computed: - versions at, above, and below the 2.11.0 boundary - v-prefixed and pre-release version strings - uncoercible strings (dev, unknown) fall back to 0.0.0 Uses a reactive ref mock so Vue's computed re-evaluates on each it.each entry without needing jest.isolateModules. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
26 tasks
21 tasks
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.
🤖 Test Improver — automated AI assistant
Goal and Rationale
shell/composables/useRuntimeFlag.tshad zero test coverage despite containing meaningful semver-based version-gating logic:featureDropdownMenuusessemver.coerce()to normalise version strings (stripsvprefixes, pre-release tags, uncoercible strings fall back to0.0.0)semver.gte()compares against the2.11.0boundaryBugs here would silently disable the dropdown menu feature for all users.
Approach
@shell/utils/version.getVersionInfoto return a reactiveref-backed version stringfeatureDropdownMenucomputed auto-invalidates whenmockVersion.valuechanges (Vue reactive dependency tracking)it.eachtable with 8 cases — nojest.isolateModulesneededuseRuntimeFlag({} as any)called once at describe-level; the returnedfeatureDropdownMenuref is shared across all entriesCoverage Impact
Test Cases
2.11.0true(at boundary)2.12.0true(above boundary)v2.11.0true(v-prefixed, coerced to 2.11.0)2.11.0-rc1true(pre-release, coerced to 2.11.0)2.10.9false(just below boundary)2.0.0false(well below boundary)devfalse(uncoercible → falls back to 0.0.0)unknownfalse(uncoercible → falls back to 0.0.0)Test Status
Reproducibility
Trade-offs
jest.isolateModulesboilerplate while correctly invalidating Vue's computed cache between test entriesWarning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
download.cypress.ioSee Network Configuration for more information.