test: extend wizard framework, steps, and flows tests#167
Open
ppn26 wants to merge 2 commits into
Open
Conversation
Add model-level unit tests for cdListModel (Init, Update, View) and addHookStep to cover the previously-untested 0% functions in the flows package, bringing coverage from 15.7% to 30.2%. - Test all three cdListModel methods directly (Init/Update/View) - Cover cdListModel.Update branches: ctrl+c, esc (with/without filter), enter - Test addHookStep: nil hooks, with hooks, default pre-selection, label formatting - Add minor supplementary tests for buildBranchOptions and pruneOptionValue The interactive entry points (CdInteractive, CheckoutInteractive, etc.) that call tea.NewProgram().Run() remain untestable without a TTY harness. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds comprehensive unit tests for the wizard framework and steps packages to significantly increase coverage. - framework/styles_test.go: new file testing all 19 style functions (was 0%) - framework/wizard_test.go: View(), renderStepTabs(), renderSummary(), SetCurrentStep(), GetStrings() all branches, unknown message handling, StepAdvance on last step with/without skipSummary - steps/filterable_list_test.go: View(), Help(), GetSelectedOption(), GetSelectedValue(), WithValueLabel(), navigation edge cases (up/down focus transitions, backspace, pgup/pgdn), multi-select max constraint, scroll indicators, fuzzy highlight, String(), containsStr helper - steps/single_select_test.go: View(), RenderWithScroll() with scroll indicators, EnableAllOptions(), Value() when unselected, SetOptions() clearing out-of-bounds selection, String(), GetOption() out-of-bounds, FormatValue() when not selected - steps/text_input_test.go: View(), validation error display, WithCursor(), String() Coverage: framework 54.1% → 94.4%, steps 59.4% → 89.1% Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Add unit tests for the interactive wizard UI packages, covering View(),
Update(), Init() methods and style functions.
wizard/framework: 54.1% → 94.4% (styles, View, renderStepTabs, renderSummary, GetStrings)wizard/steps: 59.4% → 89.1% (FilterableList View/Help/navigation, SingleSelect View/scroll, TextInput View/cursor)wizard/flows: 15.7% → 30.2% (cdListModel Init/Update/View, addHookStep)The remaining uncovered code in flows requires
tea.NewProgram(real terminal),which is not unit-testable without a TUI test harness.
Test Coverage
🤖 Generated with Claude Code