use super::helpers::*;
#[test]
fn test_sync_creation() {
let (_base_db, sync) = setup();
assert!(!sync.sync_tree_root_id().to_string().is_empty());
let sync_tree = sync.sync_tree();
assert!(!sync_tree.root_id().to_string().is_empty());
}
#[test]
fn test_sync_load() {
use eidetica::sync::Sync;
let (base_db, sync) = setup();
let sync_root_id = sync.sync_tree_root_id().clone();
let loaded_sync = Sync::load(base_db.clone(), &sync_root_id).unwrap();
assert_trees_equal(&sync, &loaded_sync);
}
#[test]
fn test_sync_settings_operations() {
let (_base_db, sync) = setup();
sync.set_setting("test_setting", "test_value").unwrap();
assert_setting(&sync, "test_setting", "test_value");
assert_setting_not_found(&sync, "non_existent");
sync.set_setting("test_setting", "updated_value").unwrap();
assert_setting(&sync, "test_setting", "updated_value");
}
#[test]
fn test_sync_settings_persistence() {
use eidetica::sync::Sync;
let (base_db, sync) = setup();
sync.set_setting("persistent_setting", "persistent_value")
.unwrap();
let sync_root_id = sync.sync_tree_root_id().clone();
let loaded_sync = Sync::load(base_db.clone(), &sync_root_id).unwrap();
assert_setting(&loaded_sync, "persistent_setting", "persistent_value");
}
#[test]
fn test_sync_multiple_settings() {
let (_base_db, sync) = setup();
let settings_to_set = &[
("config_option_1", "value_1"),
("config_option_2", "value_2"),
("server_url", "https://example.com"),
];
set_multiple_settings(&sync, settings_to_set);
assert_multiple_settings(&sync, settings_to_set);
}