mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-05-15 00:56:32 +08:00
67aa275599
This commit refactors all tests to work with the new database-based architecture, replacing the previous JSON config approach. Key changes: - Add Database export to lib.rs for test access - Create test helper functions in support.rs: - create_test_state(): Creates empty test state with fresh DB - create_test_state_with_config(): Migrates JSON config to DB - Fix environment isolation in provider_service tests: - provider_service_switch_missing_provider_returns_error - provider_service_switch_codex_missing_auth_returns_error - Replace ignored export tests with working alternatives: - export_sql_writes_to_target_path (tests Database::export_sql) - export_sql_returns_error_for_invalid_path (tests error handling) - Update error type matching to align with current implementation All tests now: - Use isolated test environments (test_mutex + reset_test_fs) - Access data via Database API instead of RwLock<MultiAppConfig> - Work with SQLite persistence layer - Pass without environment pollution or race conditions Fixes test compilation errors after database migration.