Skip to content

test: add 26 unit tests for session-parser - #246

Open
TerminalGravity wants to merge 1 commit into
mainfrom
test/session-parser-unit-tests
Open

test: add 26 unit tests for session-parser#246
TerminalGravity wants to merge 1 commit into
mainfrom
test/session-parser-unit-tests

Conversation

@TerminalGravity

@TerminalGravity TerminalGravity commented Mar 13, 2026

Copy link
Copy Markdown
Collaborator

Adds comprehensive test coverage for src/lib/session-parser.ts, the core library that parses Claude Code JSONL sessions into timeline events.

What's tested

  • findSessionFiles: directory scanning, subagent discovery, mtime tracking
  • parseSession: user prompts, assistant responses, content block arrays, correction detection, tool call extraction, sub_agent_spawn, error detection, compaction events, summary records, malformed line tolerance, timestamp normalization (ISO/epoch-s/epoch-ms), content preview, empty files, source tracking

26 new tests, all passing. Total suite: 69 tests.

@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.

18 tests for session-parser — great coverage addition. These will catch regressions as the parser evolves. ✅

Covers parseSession and findSessionFiles:
- User prompts, assistant responses, content block arrays
- Correction detection across multiple patterns
- Tool call extraction and sub_agent_spawn detection
- Error detection in tool_result (is_error + stderr pattern)
- Compaction event detection
- Summary record handling (branch + session id)
- Malformed JSON line tolerance
- Timestamp normalization (ISO, epoch seconds, epoch ms)
- Content preview generation and truncation
- Subagent file discovery
- Source file/line tracking
- Empty file handling
@TerminalGravity
TerminalGravity force-pushed the test/session-parser-unit-tests branch from b1e2827 to bbfb1b8 Compare March 18, 2026 15:46
@TerminalGravity TerminalGravity changed the title test: add 18 unit tests for session-parser module test: add 26 unit tests for session-parser Mar 18, 2026
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