From 07b5c35e9065ca94e3ae7141c641c17ca61dce62 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 28 Apr 2021 22:21:16 +1000 Subject: [PATCH] confirm deletion is requiring a full sync --- rslib/src/deckconfig/update.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/rslib/src/deckconfig/update.rs b/rslib/src/deckconfig/update.rs index b6b2d28a9..2e69a4583 100644 --- a/rslib/src/deckconfig/update.rs +++ b/rslib/src/deckconfig/update.rs @@ -197,6 +197,16 @@ mod test { col.add_note(&mut note, DeckId(1))?; } + // pretend we're in sync + let stamps = col.storage.get_collection_timestamps()?; + col.storage.set_last_sync(stamps.schema_change)?; + + let full_sync_required = |col: &mut Collection| -> bool { + col.storage + .get_collection_timestamps() + .unwrap() + .schema_changed_since_sync() + }; let reset_card1_pos = |col: &mut Collection| { let mut card = col.storage.get_card(card1_id).unwrap().unwrap(); // set it out of bounds, so we can be sure it has changed @@ -256,6 +266,7 @@ mod test { // removing the config will assign the selected config (default in this case), // and as default has normal sort order, that will reset the order again + assert!(!full_sync_required(&mut col)); reset_card1_pos(&mut col); input.configs.remove(1); input.removed_config_ids.push(DeckConfigId(allocated_id)); @@ -263,6 +274,8 @@ mod test { let current_id = col.get_deck(DeckId(1))?.unwrap().normal()?.config_id; assert_eq!(current_id, 1); assert_eq!(card1_pos(&mut col), 1); + // should have forced a full sync + assert!(full_sync_required(&mut col)); Ok(()) }