Skip to content

test: add 21 tests for session-parser lib - #27

Closed
TerminalGravity wants to merge 1 commit into
mainfrom
test/session-parser-coverage
Closed

test: add 21 tests for session-parser lib#27
TerminalGravity wants to merge 1 commit into
mainfrom
test/session-parser-coverage

Conversation

@TerminalGravity

Copy link
Copy Markdown
Collaborator

Adds comprehensive test coverage for src/lib/session-parser.ts — a core library with zero prior tests.

21 tests covering:

  • Prompt and assistant event parsing
  • Correction detection (after assistant messages)
  • Tool call extraction from array content blocks
  • Sub-agent spawn detection (Task/dispatch_agent)
  • Compaction and error event detection
  • Malformed JSON line handling (graceful skip)
  • Epoch and epoch-ms timestamp normalization
  • Empty content skipping
  • Content preview truncation
  • Subagent file discovery in nested dirs
  • Async/sync parser parity
  • Timestamp-sorted output from parseAllSessions
  • Since filter for mtime-based filtering

Bumps test count from 43 → 64.

@TerminalGravity TerminalGravity left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

21 tests for session-parser — solid coverage for a core module. LGTM 👍

Covers: findSessionFiles, parseSession, parseSessionAsync, parseAllSessions
Tests include: user prompts, assistant responses, content blocks, correction
detection, sub-agent spawns, tool_result errors, compaction events, branch
extraction from summary records, malformed JSON handling, epoch timestamp
normalization, empty message skipping, since-date filtering, and sync/async
parity.
@TerminalGravity
TerminalGravity force-pushed the test/session-parser-coverage branch from 7f33199 to 2c1ca2b Compare March 2, 2026 23:15
@TerminalGravity

Copy link
Copy Markdown
Collaborator Author

Superseded by newer PRs.

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