refactor: extract shared base-args helper in main_test.go subprocess tests #154

Closed
opened 2026-05-15 08:36:05 +00:00 by rodin · 0 comments
Owner

Background

During review of PR #151, sonnet noted that TestMainSubprocess_InvalidDocMapPath and TestMainSubprocess_InvalidDocMapFile (and other subprocess tests) pass the same required flags verbatim. If the required-flag set changes, multiple tests need updating.

Proposed Change

Extract a baseSubprocessArgs() helper function (similar to cleanEnv()) that returns the base set of required flags for subprocess tests. Each test function appends its own test-specific flags.

This reduces duplication and makes adding/removing required flags a one-line change.

Scope

Mainly cmd/review-bot/main_test.go. Non-trivial refactor since many test functions are involved.

Origin

Deferred from PR #151 fix plan (sonnet NIT finding #2).

## Background During review of PR #151, sonnet noted that `TestMainSubprocess_InvalidDocMapPath` and `TestMainSubprocess_InvalidDocMapFile` (and other subprocess tests) pass the same required flags verbatim. If the required-flag set changes, multiple tests need updating. ## Proposed Change Extract a `baseSubprocessArgs()` helper function (similar to `cleanEnv()`) that returns the base set of required flags for subprocess tests. Each test function appends its own test-specific flags. This reduces duplication and makes adding/removing required flags a one-line change. ## Scope Mainly `cmd/review-bot/main_test.go`. Non-trivial refactor since many test functions are involved. ## Origin Deferred from PR #151 fix plan (sonnet NIT finding #2).
rodin closed this issue 2026-05-15 11:30:18 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rodin/review-bot#154