Refactoring Opportunity
Summary
- File:
src/docker-manager-compose.test.ts
- Current size: 3,525 lines
- Responsibilities identified: 10+ distinct test areas under one
describe block
Evidence
The file has a single top-level describe('docker-manager generateDockerCompose') that contains deeply nested describe blocks covering every container service and every config option:
line 18: describe('generateDockerCompose')
line 1579: describe('envFile option')
line 1668: describe('enableHostAccess option')
line 1784: describe('allowHostPorts option')
line 2058: describe('API proxy sidecar') ← ~450 lines
line 2509: describe('AWF_ANTHROPIC_* env var forwarding')
line 2975: describe('DNS-over-HTTPS proxy sidecar') ← ~100 lines
line 3074: describe('CLI proxy sidecar (external DIFC proxy)') ← ~260 lines
line 3333: describe('toolchain var fallback')
line 3413: describe('GITHUB_PATH integration')
At 3,525 lines, this is the largest file in the repository and corresponds directly to the bloated compose-generator.ts it tests.
Proposed Split
Aligned with the proposed compose-generator.ts split (#2540):
src/services/squid-service.test.ts — Squid service tests
src/services/agent-service.test.ts — Agent container + bind mount tests
src/services/api-proxy-service.test.ts — API proxy sidecar tests (currently ~450 lines)
src/services/doh-proxy-service.test.ts — DoH proxy tests
src/services/cli-proxy-service.test.ts — CLI proxy tests (~260 lines)
src/compose-generator.test.ts — Integration tests for the assembled compose config (~300 lines)
Effort Estimate
Medium — splitting follows the natural describe block boundaries. Shared test fixtures/setup may need extraction to a test-helpers module.
Benefits
- Jest can run service-specific tests in parallel, reducing test suite time
- Easier to identify which service area a failing test covers
- Smaller test files are faster to navigate during code review
- Naturally aligns with the
compose-generator.ts refactoring
Detected by Refactoring Scanner workflow. Run date: 2026-05-05
Generated by Refactoring Opportunity Scanner · ● 350.4K · ◷
Refactoring Opportunity
Summary
src/docker-manager-compose.test.tsdescribeblockEvidence
The file has a single top-level
describe('docker-manager generateDockerCompose')that contains deeply nested describe blocks covering every container service and every config option:At 3,525 lines, this is the largest file in the repository and corresponds directly to the bloated
compose-generator.tsit tests.Proposed Split
Aligned with the proposed
compose-generator.tssplit (#2540):src/services/squid-service.test.ts— Squid service testssrc/services/agent-service.test.ts— Agent container + bind mount testssrc/services/api-proxy-service.test.ts— API proxy sidecar tests (currently ~450 lines)src/services/doh-proxy-service.test.ts— DoH proxy testssrc/services/cli-proxy-service.test.ts— CLI proxy tests (~260 lines)src/compose-generator.test.ts— Integration tests for the assembled compose config (~300 lines)Effort Estimate
Medium — splitting follows the natural
describeblock boundaries. Shared test fixtures/setup may need extraction to atest-helpersmodule.Benefits
compose-generator.tsrefactoringDetected by Refactoring Scanner workflow. Run date: 2026-05-05