Skip to content

test: add unit tests for buildSnapshotContent, buildSnapshotMarkdown, and extractMessageText#255

Merged
claude[bot] merged 1 commit intomainfrom
claude/issue-252-20260228-1323
Feb 28, 2026
Merged

test: add unit tests for buildSnapshotContent, buildSnapshotMarkdown, and extractMessageText#255
claude[bot] merged 1 commit intomainfrom
claude/issue-252-20260228-1323

Conversation

@claude
Copy link
Contributor

@claude claude bot commented Feb 28, 2026

Summary

Adds 7 unit tests to cmd/precompact_test.go covering the three core functions identified in #252:

  • extractMessageText: plain string passthrough, joining structured content blocks, skipping non-text blocks (e.g. tool_use)
  • buildSnapshotMarkdown: both sections appear when data is present; fallback placeholder appears when empty
  • buildSnapshotContent: last-5-user-message trimming from a JSONL fixture; reverse-deduplication of file paths keeps only the last occurrence

The go vet ./cmd/... check passes cleanly. (A pre-existing vet error in internal/config/config_test.go is unrelated to this change.)

Closes #252

Generated with Claude Code

… and extractMessageText

Covers all 7 cases specified in issue #252:
- extractMessageText: plain string, content block array, non-text block skipping
- buildSnapshotMarkdown: both sections present with data, fallback placeholder when empty
- buildSnapshotContent: last-5 user message trimming, file path deduplication

Co-Authored-By: Grey Newell <greyshipscode@gmail.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@claude claude bot merged commit 3615ec4 into main Feb 28, 2026
1 check passed
@claude claude bot deleted the claude/issue-252-20260228-1323 branch February 28, 2026 13:44
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.

test: add unit tests for buildSnapshotContent, buildSnapshotMarkdown, and extractMessageText

0 participants