Skip to content

test: cover local-command handlers and arg validation#75

Merged
gmpassos merged 3 commits into
masterfrom
test/improve-coverage-local-command
Jun 23, 2026
Merged

test: cover local-command handlers and arg validation#75
gmpassos merged 3 commits into
masterfrom
test/improve-coverage-local-command

Conversation

@gmpassos

Copy link
Copy Markdown
Contributor

Summary

Improves test coverage by targeting the biggest real gap — local_command.dart (was 26.7%, 569 uncovered lines), the interactive : command layer. (The 0% winpty_* files are Windows-only and already covered by the Windows CI runner.)

Adds 23 offline unit tests (no live Hub connection required):

  • Context-reading commands: :os, :arch, :host, :whoami (with/without principal, sorted roles), :node (with/without labels), :capabilities (with/without advertised caps), :session, :info (UID + labels + fixed-clock session duration via an injected clock).
  • Registry behaviour: duplicate-name and alias-collision ArgumentErrors, command dedup + sort, alias dispatch (:quit → exit), blank : lines, non-local lines returning false.
  • Argument validation (branches that return before any network call): :tunnel (usage, port range, malformed --public-port, close with no id), :drive (unknown subcommand, missing mount-id for status/sync/diff/conflicts/remount, --push+--pull conflict, unwatch with no watchers), :detach with no session.

Results

Metric Before After
Tests passing 448 471
local_command.dart 26.7% 42.0%
Overall line coverage 76.9% 78.6%

dart analyze on the test file is clean. A small chore commit gitignores the generated coverage/ directory.

🤖 Generated with Claude Code

gmpassos and others added 3 commits June 23, 2026 04:12
Add offline unit tests for LocalCommandRegistry's context-reading
commands (:os/:arch/:host/:whoami/:node/:capabilities/:session/:info),
registry behaviour (duplicate/alias registration, dedup+sort, alias
dispatch, blank/non-local lines), and the no-network argument-validation
branches of :tunnel, :drive and :detach.

Raises local_command.dart coverage 26.7% -> 42.0% and overall line
coverage 76.9% -> 78.6%.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gmpassos gmpassos merged commit 9ad6a27 into master Jun 23, 2026
5 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.

1 participant