Skip to content

test: extend wizard framework, steps, and flows tests#167

Open
ppn26 wants to merge 2 commits into
raphi011:mainfrom
ppn26:test-wizard-ui-tests
Open

test: extend wizard framework, steps, and flows tests#167
ppn26 wants to merge 2 commits into
raphi011:mainfrom
ppn26:test-wizard-ui-tests

Conversation

@ppn26

@ppn26 ppn26 commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

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

  • Unit tests added: 50+
  • Integration tests added: 0

🤖 Generated with Claude Code

ppn26 and others added 2 commits April 1, 2026 13:05
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

codecov Bot commented Apr 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant