Skip to content

[#100] Add GlobalSyncStrategy test coverage through Configurator#239

Merged
bguidolim merged 4 commits intomainfrom
feature/100-global-sync-strategy-tests
Mar 6, 2026
Merged

[#100] Add GlobalSyncStrategy test coverage through Configurator#239
bguidolim merged 4 commits intomainfrom
feature/100-global-sync-strategy-tests

Conversation

@bguidolim
Copy link
Owner

Summary

Closes the test gap reported in #100: GlobalSyncStrategy had zero test coverage through the unified Configurator. Adds 30 new tests exercising all global-scope-specific behaviors.

Changes

  • Extract MockClaudeCLI and MockTechPack from ProjectConfiguratorTests.swift into shared TestHelpers.swift (private → internal)
  • Add TrackingMockTechPack (class-based) to verify configureProject is NOT called in global scope
  • Add GlobalConfiguratorTests.swift with 10 test suites covering:
    • MCP scope override — always "user" regardless of pack declaration (4 tests)
    • Settings composition — user settings preservation, hook dedup, corrupt JSON, global path prefix (6 tests)
    • CLAUDE.md composition — global file, user content preservation, section tracking (4 tests)
    • File installation — skills/hooks to ~/.claude/, relative path recording, stale removal (4 tests)
    • Built-in values — empty dict in global scope (1 test)
    • Convergence flowconfigureProject hooks not called (1 test)
    • Unconfigure pack — MCP/file/template/settings removal, deselection convergence (5 tests)
    • Dry run — no files created, state preserved (2 tests)
    • Excluded components — excluded MCP/file removal with global paths (2 tests)
    • State and indexglobal-state.json location, __global__ sentinel (2 tests)

Test plan

  • swift test passes locally (686 tests, 0 failures)
  • swiftformat --lint . and swiftlint pass without violations
  • Affected commands verified with a real pack (N/A — test-only change)

- Extract MockClaudeCLI and MockTechPack into shared TestHelpers.swift
- Add GlobalConfiguratorTests.swift with 30 tests across 10 suites covering
  MCP scope override, settings preservation, file installation, convergence
  flows, unconfigure, dry-run, excluded components, and state tracking
- Add TrackingMockTechPack for verifying configureProject is not called
- Extract shared makeGlobalTmpDir() and makeGlobalConfigurator() into TestHelpers.swift, removing 9 duplicated copies
- Replace stringly-typed "user" scope with Constants.MCPScope.user
- Strengthen corrupt JSON test to assert MCSError.fileOperationFailed specifically
@bguidolim bguidolim force-pushed the feature/100-global-sync-strategy-tests branch from 923ff22 to 536a43d Compare March 6, 2026 08:13
- Require running swiftformat and swiftlint on changed files before committing
@bguidolim bguidolim merged commit 755e922 into main Mar 6, 2026
4 checks passed
@bguidolim bguidolim deleted the feature/100-global-sync-strategy-tests branch March 6, 2026 08:17
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.

1 participant