Skip to content

test(backends/gadgets): add tests for nativeToolPrompts, TmuxGadget, catalog, definitions#936

Merged
aaight merged 1 commit intodevfrom
feature/add-tests-native-tool-prompts-tmux-catalog
Mar 17, 2026
Merged

test(backends/gadgets): add tests for nativeToolPrompts, TmuxGadget, catalog, definitions#936
aaight merged 1 commit intodevfrom
feature/add-tests-native-tool-prompts-tmux-catalog

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 17, 2026

Summary

Adds comprehensive test coverage for the top untested areas, covering ~2,000 previously untested lines across 5 test files with 192 new test cases.

Card: https://trello.com/c/G4wFhC5z/453-add-tests-for-nativetoolprompts-and-tmuxgadget-top-untested-areas

What was added

  • tests/unit/backends/shared-nativeToolPrompts.test.ts (32 tests) — Tests for buildToolGuidance, formatParam (all param types: string, boolean, array), buildSystemPrompt, and buildTaskPrompt (mocking contextFiles module)
  • tests/unit/gadgets/tmux/TmuxGadget.test.ts (25 tests) — All 6 TmuxGadget actions: start (exit detection, timeout, CommandFailedError, git validation), capture (running/exited/not_found), send, kill, list, exists
  • tests/unit/gadgets/tmux/TmuxControlClient.test.ts (30 tests) — connect(), checkExitMarker(), parseLine() protocol parsing (begin/end blocks, %output buffering, %message), createWindow() (base64 encoding), killWindow(), sendKeys()
  • tests/unit/backends/catalog.test.ts (33 tests) — DEFAULT_ENGINE_CATALOG integrity (4 engines, no duplicates) and individual engine definitions (capabilities, settings fields, model selection)
  • tests/unit/gadgets/github/definitions.test.ts (37 tests) + tests/unit/gadgets/pm/definitions.test.ts (35 tests) — Schema integrity for all 10 SCM and 9 PM tool definitions

Key decisions

  • Mocked node:readline to avoid createInterface needing a real stream
  • Used vi.spyOn(privateClient, 'sendCommand') for TmuxControlClient method tests
  • Used wait: 100 in TmuxGadget start tests to make the polling loop exit quickly

Testing

  • All 192 new tests pass; full suite: 5672 tests, 300 files — zero failures
  • TypeScript and lint: zero errors

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 17, 2026

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

LGTM — 192 well-structured tests covering previously untested areas across 5 files. All CI checks pass. No issues found.

The tests are thorough and correctly verify the behavior of nativeToolPrompts, TmuxGadget, TmuxControlClient, engine catalog definitions, and GitHub/PM gadget definitions. Mocking strategies are appropriate (readline, child_process, sleep, control client), and edge cases like exit marker parsing, pane-dead fallback, git command validation, and session name sanitization are all well covered.

One trivial nit: afterEach is imported but unused in TmuxGadget.test.ts (line 1) — not worth blocking over since lint passes, but could be cleaned up.

🕵️ claude-code · claude-opus-4-6 · run details

@aaight aaight merged commit 59f85ac into dev Mar 17, 2026
6 checks passed
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.

2 participants