test: add unit tests for diff-view pure functions - #26
Conversation
|
🤖 KlaatAI Review Bot (powered by Klaatu, advisory only — a maintainer makes the real call) Issue match Test coverage Correctness concerns
Verdict This is an automated review to help triage faster, not a gate. Nothing here blocks merging. |
|
@siddhanttiwari19 can you please link the issue in this pr. |
|
Closes #4 — linked in the PR description. Also pushed an updated commit that adds |
|
@siddhanttiwari19 Really appreciate you taking the time to improve KlaatCode. Your contribution helps make the project better for everyone. If you haven't already, we'd love it if you could ⭐ star the repository and follow https://github.com/KlaatAI on GitHub to stay updated with new features and releases. Feel free to keep using KlaatAI for your projects, and don't hesitate to open more issues, suggest ideas, or submit future PRs—we're always happy to have contributors like you in the community. Looking forward to seeing your next contribution. Happy coding! 🚀 |
Summary
Adds unit tests for all five pure diff-building functions in
src/screens/diff-view.ts,following the conventions in
apply-patch.test.ts(bun:test, describe/test/expect).Coverage
buildEditDiff: prefix/suffix trimming, ctx=1 context window, MAX_LINES (24) cap, no-change, empty input, gutter line numbers on/offbuildMultiEditDiff: blank separator between hunks with correct content partitioning, combined capbuildWriteDiff: all-added-lines sign, numbering from 1, empty file, large file capbuildPatchDiff: add/delete/update ops, moveTo rename header, multi-op separator, empty input, caplineOf: exact match, first-line fallback, no-match (undefined), line 1, empty haystackdiffStat: add/del counts, zero counts, write-only diff, context lines excluded, empty arrayHow I verified it
bun test— 31/31 new tests pass, 73/73 across the full suite, 0 failuresbun run typecheck— no type errorsbun run build— clean build (0.34 MB, 70 modules)Refs #4