Skip to content

test(presentation): swap hand-written test stubs for committed counterfeiter fakes - #1924

Merged
edenreich merged 1 commit into
mainfrom
fix/issue-1920
Nov 20, 2026
Merged

edenreich merged 1 commit into
mainfrom
fix/issue-1920

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Resolves #1920

Summary

Swaps the remaining hand-written test doubles for the counterfeiter fakes that are already committed under tests/mocks/, per the Testing rule in AGENTS.md. The embedded-interface stubs in application_view_test.go would have panicked on any method they did not override, and the hand-rolled mockModelService duplicated five convdomain.ModelService methods outside the generated source of truth. Test-only change: no production code, no new counterfeiter line in Taskfile.yml, and no regenerated mocks.

Changes

  • internal/presentation/tui/components/application_view_test.go: deleted stubModeState, stubStatusView, stubInputView and stubHelpBar. The mode indicator now reads agentdomainmocks.FakeAgentModeState via GetAgentModeReturns, and the row/composer tests pass tuimocks.FakeStatusComponent (RenderReturns), tuimocks.FakeInputComponent and tuimocks.FakeHelpBarComponent.
  • internal/presentation/shortcuts/model_test.go: deleted mockModelService and its five methods. The tests use conversationmocks.FakeModelService through GetCurrentModelReturns and ValidateModelReturns, and the permanent-switch test now asserts SelectModelCallCount plus SelectModelArgsForCall(0) instead of reading the stub's currentModel field.
  • internal/presentation/shortcuts/core_test.go and effort_test.go: these same-package tests shared the deleted mockModelService, so they now use convmocks.FakeModelService / conversationmocks.FakeModelService with GetCurrentModelReturns as well. This extends the diff beyond the two files named in the issue; the package would not otherwise compile.
  • Imports keep the six-group layout with the canonical agentdomainmocks, tuimocks and conversationmocks aliases.
  • Left out on purpose, matching the issue: stubTokenEstimator in core_test.go and stubShortcut in noninteractive_test.go have no committed counterpart fake, so swapping them needs new mock generation or an external test package first.

Verification

  • task precommit:run passes (mod tidy, mocks up to date, fmt, import alias lint, golangci-lint 0 issues, markdownlint).
  • go test ./internal/presentation/shortcuts/... ./internal/presentation/tui/components/... passes.

no docs ticket: test-only refactor with no user-facing behavior change.

…unterfeiter fakes

Delete stubModeState, stubStatusView, stubInputView, stubHelpBar and mockModelService, and wire agentdomainmocks, tuimocks and conversationmocks fakes instead. PermanentSwitch now asserts SelectModelArgsForCall instead of reading the stub's currentModel field.
@github-project-automation github-project-automation Bot moved this to Todo in 2026 Nov 20, 2026
@inference-gateway-maintainer
inference-gateway-maintainer Bot marked this pull request as ready for review November 20, 2026 14:59
@inference-gateway-maintainer
inference-gateway-maintainer Bot requested a review from a team as a code owner November 20, 2026 14:59
@edenreich
edenreich merged commit e0ff79b into main Nov 20, 2026
1 check passed
@edenreich
edenreich deleted the fix/issue-1920 branch November 20, 2026 15:36
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.265.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Nov 20, 2026
@edenreich edenreich moved this from Todo to Done in 2026 Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[TASK] Refactor hand-written test stubs onto the committed counterfeiter fakes

1 participant