mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-29 09:37:37 +08:00
test: migrate tests to SQLite database architecture
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.
This commit is contained in:
@@ -26,6 +26,7 @@ pub use app_config::{AppType, McpApps, McpServer, MultiAppConfig};
|
||||
pub use codex_config::{get_codex_auth_path, get_codex_config_path, write_codex_live_atomic};
|
||||
pub use commands::*;
|
||||
pub use config::{get_claude_mcp_path, get_claude_settings_path, read_json_file};
|
||||
pub use database::Database;
|
||||
pub use deeplink::{import_provider_from_deeplink, parse_deeplink_url, DeepLinkImportRequest};
|
||||
pub use error::AppError;
|
||||
pub use mcp::{
|
||||
|
||||
Reference in New Issue
Block a user