Skip to content

Add unit tests for getBranchName fallback behavior #106

@404-Page-Found

Description

@404-Page-Found

Task summary

Add focused unit tests for getBranchName() in src/git/diff.ts, including the fallback path that should return "unknown" when git commands fail.

Why this is a good first issue

The function is small, behavior is clear, and there is already an established test style in tests/git-diff.test.mjs to follow.

Suggested files or areas

  • src/git/diff.ts
  • tests/git-diff.test.mjs

Acceptance criteria

  • Add at least one success test that verifies getBranchName() returns the current branch in a temp repo.
  • Add at least one failure-path test that simulates git command failure and verifies the return value is "unknown".
  • Keep all existing git/diff tests passing.

Extra context

getRepoRoot() is already tested in tests/git-diff.test.mjs; use that file’s temp-repo helper pattern for consistency.

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions