Skip to content

test: add comprehensive tests for session-parser (19 tests) - #233

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

test: add comprehensive tests for session-parser (19 tests)#233
TerminalGravity wants to merge 1 commit into
mainfrom
test/session-parser-coverage-v3

Conversation

@TerminalGravity

Copy link
Copy Markdown
Collaborator

Adds 19 unit tests for src/lib/session-parser.ts — previously had zero test coverage despite being a critical module used by scorecard, timeline, and session-stats tools.

Coverage includes:

  • User prompt parsing (string + array content)
  • Assistant response parsing with model metadata
  • Correction detection ("no", "wrong", "not that", etc.)
  • Tool call extraction from assistant tool_use blocks
  • Sub-agent spawn detection (Task / dispatch_agent)
  • Error event detection from tool_result
  • Compaction event detection from system messages
  • Summary record parsing (sessionId, branch)
  • Malformed JSON line handling (graceful skip)
  • Empty file handling
  • Epoch timestamp normalization
  • Content preview truncation
  • Unique ID generation
  • findSessionFiles with subagent directory support

All 62 tests pass (43 existing + 19 new).

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