Skip to content

[plan][refactor]: Consolidate test helper files helpers-gh-mock.sh and helpers-open-issue.sh #595

@were

Description

@were

Description

The test helper file tests/helpers-open-issue.sh is a 7-line wrapper that only sources tests/helpers-gh-mock.sh without providing any additional functionality. This redundancy adds unnecessary indirection and maintenance overhead.

Related modules:

  • tests/helpers-gh-mock.sh - Contains the actual gh CLI mock functions
  • tests/helpers-open-issue.sh - Redundant wrapper to be eliminated
  • 5 e2e tests in tests/e2e/ that source the wrapper

Proposed Solution

Goal

Eliminate redundant test helper file tests/helpers-open-issue.sh which is a thin wrapper that only sources tests/helpers-gh-mock.sh, providing no additional value.

Success criteria:

  • All 5 tests in tests/e2e/ that currently source helpers-open-issue.sh are updated to source helpers-gh-mock.sh directly
  • The file tests/helpers-open-issue.sh is deleted
  • All tests continue to pass with no behavioral changes
  • Documentation is updated to reflect the consolidation

Out of scope:

  • Modifying the mock functions themselves (create_gh_stub(), setup_gh_mock_open_issue())
  • Changing test behavior or adding new functionality
  • Modifying any tests beyond the sourcing statement update

File Changes

File Level Purpose
tests/README.md minor Remove reference to deleted helper file
tests/e2e/test-open-issue-with-draft.sh minor Update source statement to use helpers-gh-mock.sh directly
tests/e2e/test-open-issue-without-draft.sh minor Update source statement to use helpers-gh-mock.sh directly
tests/e2e/test-open-issue-update-mode.sh minor Update source statement to use helpers-gh-mock.sh directly
tests/e2e/test-open-issue-update-maintains-format.sh minor Update source statement to use helpers-gh-mock.sh directly
tests/e2e/test-open-issue-draft-non-plan.sh minor Update source statement to use helpers-gh-mock.sh directly
tests/helpers-open-issue.sh delete Remove redundant wrapper file

Implementation Steps

Step 1: Update documentation (Estimated: ~5 LOC)

  • tests/README.md:16 - Remove line listing helpers-open-issue.sh from Test Infrastructure section

Step 2: Update test files to source helpers-gh-mock.sh directly (Estimated: ~5 LOC)

  • tests/e2e/test-open-issue-with-draft.sh:4 - Change source "$TESTS_DIR/helpers-open-issue.sh" to source "$TESTS_DIR/helpers-gh-mock.sh"
  • tests/e2e/test-open-issue-without-draft.sh:4 - Same change
  • tests/e2e/test-open-issue-update-mode.sh:4 - Same change
  • tests/e2e/test-open-issue-update-maintains-format.sh:4 - Same change
  • tests/e2e/test-open-issue-draft-non-plan.sh:4 - Same change

Step 3: Delete redundant wrapper file

  • Delete tests/helpers-open-issue.sh (7 lines removed from codebase)

Test Strategy

Validation approach:

  • Run all 5 affected e2e tests to verify they still pass
  • Run full test suite with make test-fast to ensure no regressions

Expected outcome:

  • All tests pass with identical behavior (0% functional change)
  • No new tests needed (this is pure refactoring with no behavior change)

Total estimated complexity: ~15 LOC (Small refactoring)

Recommended approach: Single commit refactoring, no milestone needed

Related PR

TBD - will be updated when PR is created

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentize:planPlan created by /ultra-planner command

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions