mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix compact bugs & update unit tests
This commit is contained in:
@ -11,7 +11,7 @@ async fn document_sync_current_rev_id_check() {
|
||||
AssertCurrentRevId(2),
|
||||
InsertText("3", 2),
|
||||
AssertCurrentRevId(3),
|
||||
AssertNextRevId(None),
|
||||
AssertNextSyncRevId(None),
|
||||
AssertJson(r#"[{"insert":"123\n"}]"#),
|
||||
];
|
||||
EditorTest::new().await.run_scripts(scripts).await;
|
||||
@ -38,7 +38,7 @@ async fn document_sync_insert_test() {
|
||||
InsertText("2", 1),
|
||||
InsertText("3", 2),
|
||||
AssertJson(r#"[{"insert":"123\n"}]"#),
|
||||
AssertNextRevId(None),
|
||||
AssertNextSyncRevId(None),
|
||||
];
|
||||
EditorTest::new().await.run_scripts(scripts).await;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ pub enum EditorScript {
|
||||
Replace(Interval, &'static str),
|
||||
|
||||
AssertRevisionState(i64, RevisionState),
|
||||
AssertNextRevId(Option<i64>),
|
||||
AssertNextSyncRevId(Option<i64>),
|
||||
AssertCurrentRevId(i64),
|
||||
AssertJson(&'static str),
|
||||
}
|
||||
@ -60,13 +60,15 @@ impl EditorTest {
|
||||
EditorScript::AssertCurrentRevId(rev_id) => {
|
||||
assert_eq!(self.editor.rev_manager().rev_id(), rev_id);
|
||||
}
|
||||
EditorScript::AssertNextRevId(rev_id) => {
|
||||
EditorScript::AssertNextSyncRevId(rev_id) => {
|
||||
let next_revision = rev_manager.next_sync_revision().await.unwrap();
|
||||
if rev_id.is_none() {
|
||||
assert!(next_revision.is_none(), "Next revision should be None");
|
||||
return;
|
||||
}
|
||||
let next_revision = next_revision.unwrap();
|
||||
let mut receiver = rev_manager.revision_ack_receiver();
|
||||
let _ = receiver.recv().await;
|
||||
assert_eq!(next_revision.rev_id, rev_id.unwrap());
|
||||
}
|
||||
EditorScript::AssertJson(expected) => {
|
||||
|
Reference in New Issue
Block a user