Skip to content

test(smartlog): Phase 4 #310 — PARSEC_GITHUB_API_BASE + mockito overlay integration tests - #421

Merged
erishforG merged 1 commit into
release/1.0from
feat/auto-310-ci-overlay-phase4
Sep 5, 2026
Merged

test(smartlog): Phase 4 #310 — PARSEC_GITHUB_API_BASE + mockito overlay integration tests#421
erishforG merged 1 commit into
release/1.0from
feat/auto-310-ci-overlay-phase4

Conversation

@erishforG

Copy link
Copy Markdown
Owner

무엇

PARSEC_GITHUB_API_BASE 환경 변수를 추가해 테스트(및 GitHub Enterprise 사용자)가 git remote URL을 바꾸지 않고도 GitHub API 호출을 임의 엔드포인트로 라우팅할 수 있도록 합니다. 이를 기반으로 두 개의 CLI-level 통합 테스트를 추가해 issues #309 및 #310의 mock 으로 통합 테스트 1개 이상 수락 기준을 충족합니다.

Refs #309 (PR overlay — '통합 테스트 (mock)' acceptance criterion)
Refs #310 (CI overlay — 'mock 으로 통합 테스트 1개 이상' acceptance criterion)
Milestone: v1.0

변경

src/env.rs

  • PARSEC_GITHUB_API_BASE 상수 + github_api_base() 함수 추가
    (PARSEC_BITBUCKET_API_BASE 기존 패턴 동일하게 적용)

src/github/mod.rs

  • GitHubClient::new() 에서 env 오버라이드가 있으면 사용, 없으면 remote.api_base() fallback
  • 1줄 추가만으로 기존 prod 경로 무변경

tests/cli_tests.rs

  • test_smartlog_no_overlay_skips_github: --no-overlay 시 GITHUB_TOKEN 없이도 exit 0, PR/CI 배지 없음 확인
  • test_smartlog_overlay_with_mock_github: mockito 서버 기동 → git remote URL을 GitHub 스타일로 전환 → PARSEC_GITHUB_API_BASE 주입 → 5개 엔드포인트 mock → parsec smartlog[PR #99] + [CI: ✓ passed] 배지 확인

다음 Phase 힌트

Phase 5 후보:

리스크

low — 기존 prod 경로 변경 없음. env 오버라이드 미설정 시 기존 remote.api_base() 그대로 사용. 테스트 전용 변경.

롤백

git revert 8394c79 — 3개 파일, 핵심 로직 불변

Test plan

  • cargo build --quiet
  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test --quiet: 330 tests pass ✅ (83 CLI tests including 2 new overlay integration tests)

@erishforG

…ay integration tests

Add PARSEC_GITHUB_API_BASE env var override so tests (and GitHub Enterprise
users) can route GitHubClient calls to a custom API endpoint without changing
the git remote URL.  Also adds two CLI-level integration tests that close the
'mock 으로 통합 테스트' gap in issues #309 and #310.

## Changes

### src/env.rs
- PARSEC_GITHUB_API_BASE constant + github_api_base() function
  (mirrors existing PARSEC_BITBUCKET_API_BASE pattern)

### src/github/mod.rs
- GitHubClient::new() uses github_api_base() override when set
  (single-line additive change; falls back to remote.api_base() when unset)

### tests/cli_tests.rs
- test_smartlog_no_overlay_skips_github: verifies --no-overlay exits 0
  without any GitHub token and emits no PR/CI badges
- test_smartlog_overlay_with_mock_github: spins up a mockito server,
  points PARSEC_GITHUB_API_BASE at it, runs parsec smartlog, and asserts
  that [PR #99] and [CI: ✓ passed] badges appear in ASCII output

Refs #309 (통합 테스트 acceptance criterion)
Refs #310 (mock 으로 통합 테스트 acceptance criterion)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@erishforG erishforG added the auto-improvement Daily auto-generated improvement PR/issue label Sep 4, 2026
@erishforG
erishforG merged commit dae529f into release/1.0 Sep 5, 2026
12 checks passed
@erishforG
erishforG deleted the feat/auto-310-ci-overlay-phase4 branch September 5, 2026 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-improvement Daily auto-generated improvement PR/issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant