Skip to content

test(cli): comprehensive test suite for manus-agent history subcommand (+39 tests) - #132

Open
manus-use wants to merge 1 commit into
mainfrom
feat/cli-history-tests
Open

test(cli): comprehensive test suite for manus-agent history subcommand (+39 tests)#132
manus-use wants to merge 1 commit into
mainfrom
feat/cli-history-tests

Conversation

@manus-use

Copy link
Copy Markdown
Owner

Summary

Adds a comprehensive test suite for the manus-agent history subcommand, which previously had zero test coverage despite having meaningful logic (text/JSON output, filtering, clearing, ordering, malformed data handling).

What's tested (39 tests)

Text output (6 tests)

  • Entry count display, timestamps, agent type column
  • Long task truncation with ellipsis
  • Success/failure indicators (✓/✗)
  • History file path footer

JSON output (3 tests)

  • Valid JSON array output
  • Most-recent-first ordering
  • All fields preserved correctly

--limit (4 tests)

  • Default limit of 20
  • Custom limit values
  • --limit 0 shows all entries
  • Limit larger than available records

--grep (5 tests)

  • Substring filtering by task content
  • Case-insensitive matching
  • No-match empty state message
  • Combined with --limit
  • Partial match behavior

--clear (2 tests)

  • File deletion and confirmation message
  • Graceful handling of non-existent file

Empty/missing states (3 tests)

  • Non-existent history file
  • Empty history file
  • Whitespace-only file

Malformed JSONL handling (3 tests)

  • Skipping invalid JSON lines
  • Mixed valid/invalid records
  • Records with missing optional fields

_append_history helper (6 tests)

  • Parent directory creation
  • All fields written correctly
  • UTC ISO-8601 timestamps
  • Multiple appends (JSONL format)
  • Failure records
  • Unicode content

Ordering (2 tests)

  • Most-recent-first in text output
  • Most-recent-first in JSON output

Edge cases (5 tests)

  • Single record
  • Special regex characters in grep (substring, not regex)
  • Empty task field
  • Large history file (500 records)
  • Explicit --format text

Files changed

File Change
tests/test_cli_history.py New — 39 fully-mocked tests

Test results

1197 passed (baseline 1158 + 39 new), 0 failures. Ruff clean.

Duplicate check

Checked all open PRs (#64#131) and merged PRs (#39#102) — none cover history subcommand tests. PR #123 covers _run_analyze/_run_remediate/_run_discover tests (different subcommands). PR #121 covers blast-radius tests. PR #120 covers osv tests. This is the first test suite for history.

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