Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 26, 2025

This PR adds comprehensive test coverage for the threadRange utility function in src/github/utils.ts, which was previously untested.

Background

The threadRange function is a utility that creates VS Code Range objects for comment threads with specific logic for handling line ranges and character positions. Despite being an important utility function, it had no test coverage.

Changes

Added a new test case threadRange utility to src/test/issues/issuesUtils.test.ts that covers all code paths:

  • Same line with default end character: Tests the case where startLine === endLine and no endCharacter is provided (should default to 0)
  • Multi-line range with default end character: Tests different start/end lines without specifying endCharacter (should default to 300 for line selection)
  • Multi-line range with specific end character: Tests different start/end lines with a custom endCharacter value
  • Same line with specific end character: Tests same line scenario with a custom endCharacter value

The test follows existing patterns in the codebase and validates that the function correctly creates VS Code Range objects with the expected start/end positions and character offsets.

Testing

  • ✅ All existing tests continue to pass
  • ✅ New test covers 100% of the threadRange function logic
  • ✅ Code passes lint and hygiene checks
  • ✅ TypeScript compilation successful

This addresses a gap in test coverage while following the repository's established testing conventions.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] test Add test coverage for threadRange utility function Aug 26, 2025
Copilot finished work on behalf of joshspicer August 26, 2025 17:51
@Copilot Copilot AI requested a review from joshspicer August 26, 2025 17:51
Base automatically changed from joshspicer/new-chat-session to main August 26, 2025 20:49
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.

2 participants