Jason
6a9aa7aeb5
refactor(backend): phase 3 - add integration tests for config sync (partial)
Add integration test suite with isolated test environment:
- New test file: tests/import_export_sync.rs (149 lines, 3 test cases)
* sync_claude_provider_writes_live_settings: validates SSOT sync to live settings
* create_backup_skips_missing_file: edge case handling for missing config
* create_backup_generates_snapshot_file: verifies backup snapshot creation
- Test infrastructure:
* OnceLock-based isolated HOME directory in temp folder
* Mutex guard to ensure sequential test execution (avoid file system race)
* Automatic cleanup between test runs
Export core APIs for testing (lib.rs):
- AppType, MultiAppConfig, Provider (data structures)
- get_claude_settings_path, read_json_file (config utilities)
- create_backup, sync_current_providers_to_live (sync operations)
- update_settings, AppSettings (settings management)
Adjust visibility:
- import_export::sync_current_providers_to_live: fn -> pub fn
Update documentation:
- Mark Phase 3 as in-progress (🚧) in BACKEND_REFACTOR_PLAN.md
- Document current test coverage scope and pending scenarios
Test results: 7/7 passed (4 unit + 3 integration)
Build time: 0.16s
Next steps:
- Add Codex sync tests (auth.json + config.toml atomic writes)
- Add MCP sync integration tests
- Add end-to-end provider switching tests
2025-10-27 22:30:57 +08:00
..
2025-09-26 20:18:11 +08:00
2025-09-14 21:55:41 +08:00
2025-10-27 22:30:57 +08:00
2025-10-27 22:30:57 +08:00
2025-09-23 20:55:30 +08:00
2025-08-23 19:59:29 +08:00
2025-08-27 11:00:53 +08:00
2025-10-27 16:29:11 +08:00
2025-10-27 16:29:11 +08:00
2025-10-14 10:39:11 +08:00