Fix sync bug on conflicts

This commit is contained in:
daladim 2021-02-28 12:21:29 +01:00
parent 571420126f
commit 6c4ffa020c
2 changed files with 20 additions and 5 deletions

View file

@ -45,11 +45,11 @@ fn print_calendar_list(cals: &Vec<Calendar>) {
/// Populate sources with the following:
/// * At the last sync: both sources had A, B, C, D, E, F, G, H, I, J, K, L, M at last sync
/// * Before the newer sync, this will be the content of the sources:
/// * server: A, C, D, E', F', G✓, H , I', K, L, M, N
/// * cache: A, B, D', E, F'', G , H✓, I✓, J✓, K, L, M, O
/// * server: A, C, D, E', F', G✓, H , I', K, L, M, N
/// * cache: A, B, D', E, F'', G , H✓, I✓, J✓, L, M, O
///
/// Hence, here is the expected result after the sync:
/// * both: A, D', E', F', G✓, H✓, I', K, L, M, N, O
/// * both: A, D', E', F', G✓, H✓, I', K, L, M, N, O
///
/// Notes:
/// * X': name has been modified since the last sync
@ -129,6 +129,9 @@ async fn populate_test_provider() -> Provider<Cache, Cache> {
cal_server.delete_item(&task_j_id);
cal_server.get_item_by_id_mut(&task_k_id).unwrap().unwrap_task_mut()
.set_completed(true);
let task_n = Item::Task(Task::new("task N (new from server)".into(), Utc::now()));
cal_server.add_item(task_n);
@ -154,6 +157,8 @@ async fn populate_test_provider() -> Provider<Cache, Cache> {
cal_local.get_item_by_id_mut(&task_j_id).unwrap().unwrap_task_mut()
.set_completed(true);
cal_local.delete_item(&task_k_id);
let task_o = Item::Task(Task::new("task O (new from local)".into(), Utc::now()));
cal_local.add_item(task_o);