Skip to content

Add comprehensive unit tests for various library modules#153

Open
faizannazir wants to merge 2 commits intoopenai:mainfrom
faizannazir:main
Open

Add comprehensive unit tests for various library modules#153
faizannazir wants to merge 2 commits intoopenai:mainfrom
faizannazir:main

Conversation

@faizannazir
Copy link
Copy Markdown

This pull request adds comprehensive unit tests for several utility modules in the codebase, significantly increasing test coverage for argument parsing, file system operations, process management, git utilities, and prompt template handling. The new test suites verify both normal operation and error handling across a wide range of scenarios.

The most important changes are:

Argument Parsing Utilities:

  • Added a full suite of tests for parseArgs and splitRawArgumentString in args.mjs, covering positional arguments, boolean and value flags, aliases, error conditions, and advanced string splitting (e.g., quoted tokens, escapes).

File System Utilities:

  • Introduced tests for ensureAbsolutePath, createTempDir, readJsonFile, writeJsonFile, safeReadFile, and isProbablyText in fs.mjs, ensuring correct path resolution, temp directory creation, JSON file handling, safe file reading, and binary/text detection.

Process Management Utilities:

  • Added tests for terminateProcessTree, binaryAvailable, formatCommandFailure, runCommand, and runCommandChecked in process.mjs, including Unix process termination logic, binary existence checks, error formatting, and command execution behaviors.

Git Utilities:

  • Implemented tests for ensureGitRepository, getWorkingTreeState, and getCurrentBranch in git.mjs, covering repository detection, working tree status, and branch identification. Also added additional cases for resolveReviewTarget.

Prompt Template Utilities:

  • Added tests for interpolateTemplate and loadPromptTemplate in prompts.mjs, verifying template variable substitution and prompt file loading, including error handling for missing files.

Broker Endpoint Utilities:

  • Expanded tests for broker endpoint parsing and creation, including error cases for invalid input and platform-specific handling (Windows named pipes, Linux Unix sockets).

Copilot AI and others added 2 commits April 1, 2026 18:33
…, process, broker-endpoint, and git

Agent-Logs-Url: https://github.com/faizannazir/codex-plugin-cc/sessions/9e3bebf6-69e7-4e02-83f6-2b22f32d963c

Co-authored-by: faizannazir <46509741+faizannazir@users.noreply.github.com>
Add comprehensive unit tests for previously untested library modules
@faizannazir faizannazir requested a review from a team April 5, 2026 05:38
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