Skip to content

test(diff): add coverage for formatDiff string output#16

Merged
protosphinx merged 1 commit into
mainfrom
bot/test-format-diff
May 26, 2026
Merged

test(diff): add coverage for formatDiff string output#16
protosphinx merged 1 commit into
mainfrom
bot/test-format-diff

Conversation

@protosphinx
Copy link
Copy Markdown
Member

Why

formatDiff is exported from src/diff.ts and called directly by the mcprec diff CLI command, but it had zero unit tests. Any regression in its string rendering (missing sections, wrong labels, broken truncation) would go undetected by the test suite.

What

  • Add test/diff.format.test.ts with 14 test cases covering formatDiff.
  • No source files changed.

Tests

The new file tests formatDiff through these cases:

  • Identical transcript path: "identical (N pair/pairs)" with singular/plural
  • onlyInA section: header appears, method name appears, canonical params appear, custom label replaces default "A"
  • onlyInB section: header appears, method name appears, custom label replaces default "B"
  • Changed responses section: header appears, method name appears, before and after response content both visible
  • Summary line: all four counts present, custom labels appear in the "only in X" fields
  • Truncation: params longer than 80 chars get an ellipsis, params within limit are preserved intact

All 136 tests pass (122 pre-existing + 14 new).

Self-merge gate

  • all CI checks pass
  • LOC delta < 250 (added + removed)
  • no public-API surface change
  • no runtime-dependency additions
  • no workflow file changes
  • tests added or extended

Generated by Claude Code

formatDiff was exported and called by the CLI but had no unit tests.
This adds 14 cases covering: identical transcript reporting (singular
and plural), onlyInA/onlyInB section headers and custom labels, changed
response before/after content, summary line counts, and param truncation
at the 80-char boundary.
@protosphinx protosphinx added the automated Opened by the daily bot label May 26, 2026 — with Claude
@protosphinx protosphinx merged commit 9f3e46b into main May 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated Opened by the daily bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant