[tests] Add a task that has various modifications

This commit is contained in:
daladim 2021-04-05 23:26:20 +02:00
parent 6f84a0c897
commit 081fc2cbc8

View file

@ -66,13 +66,13 @@ pub struct ItemScenario {
} }
/// Generate the scenarii required for the following test: /// Generate the scenarii required for the following test:
/// * At the last sync: both sources had A, B, C, D, E, F, G, H, I, J, K, L, M✓, N✓, O✓ at last sync /// * At the last sync: both sources had A, B, C, D, E, F, G, H, I, J, K, L, M✓, N✓, O✓, P✓ at last sync
/// * Before the newer sync, this will be the content of the sources: /// * Before the newer sync, this will be the content of the sources:
/// * cache: A, B, D', E, F'', G , H✓, I✓, J✓, M, N✓, O, P, /// * cache: A, B, D', E, F'', G , H✓, I✓, J✓, M, N✓, O, P' , R
/// * server: A, C, D, E', F', G✓, H , I', K✓, M✓, N , O, Q /// * server: A, C, D, E', F', G✓, H , I', K✓, M✓, N , O, P✓, Q
/// ///
/// Hence, here is the expected result after the sync: /// Hence, here is the expected result after the sync:
/// * both: A, D', E', F', G✓, H✓, I', K✓, M, N, O, P, Q /// * both: A, D', E', F', G✓, H✓, I', K✓, M, N, O, P', Q, R
/// ///
/// Notes: /// Notes:
/// * X': name has been modified since the last sync /// * X': name has been modified since the last sync
@ -343,14 +343,19 @@ pub fn scenarii_basic() -> Vec<ItemScenario> {
tasks.push( tasks.push(
ItemScenario { ItemScenario {
id: id_p.clone(), id: id_p.clone(),
initial_state: LocatedState::None, initial_state: LocatedState::BothSynced( ItemState{
local_changes_to_apply: vec![ChangeToApply::Create(main_cal.clone(), Item::Task( calendar: main_cal.clone(),
Task::new(String::from("Task P, created locally"), id_p, SyncStatus::NotSynced, false ) name: String::from("Task P"),
))], completed: true,
}),
local_changes_to_apply: vec![
ChangeToApply::Rename(String::from("Task P, locally renamed and un-completed")),
ChangeToApply::SetCompletion(false),
],
remote_changes_to_apply: Vec::new(), remote_changes_to_apply: Vec::new(),
after_sync: LocatedState::BothSynced( ItemState{ after_sync: LocatedState::BothSynced( ItemState{
calendar: main_cal.clone(), calendar: main_cal.clone(),
name: String::from("Task P, created locally"), name: String::from("Task P, locally renamed and un-completed"),
completed: false, completed: false,
}), }),
} }
@ -373,6 +378,23 @@ pub fn scenarii_basic() -> Vec<ItemScenario> {
} }
); );
let id_r = ItemId::random();
tasks.push(
ItemScenario {
id: id_r.clone(),
initial_state: LocatedState::None,
local_changes_to_apply: vec![ChangeToApply::Create(main_cal.clone(), Item::Task(
Task::new(String::from("Task R, created locally"), id_r, SyncStatus::NotSynced, false )
))],
remote_changes_to_apply: Vec::new(),
after_sync: LocatedState::BothSynced( ItemState{
calendar: main_cal.clone(),
name: String::from("Task R, created locally"),
completed: false,
}),
}
);
tasks tasks
} }