2022-01-01 06:23:58 +00:00
|
|
|
use flowy_collaboration::entities::revision::RevisionState;
|
2021-12-26 11:10:37 +00:00
|
|
|
use flowy_test::doc_script::{EditorScript::*, *};
|
|
|
|
|
|
|
|
#[tokio::test]
|
|
|
|
async fn doc_sync_test() {
|
|
|
|
let scripts = vec![
|
|
|
|
InsertText("1", 0),
|
|
|
|
InsertText("2", 1),
|
|
|
|
InsertText("3", 2),
|
|
|
|
AssertJson(r#"[{"insert":"123\n"}]"#),
|
|
|
|
AssertNextRevId(None),
|
|
|
|
];
|
|
|
|
EditorTest::new().await.run_scripts(scripts).await;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[tokio::test]
|
|
|
|
async fn doc_sync_retry_ws_conn() {
|
|
|
|
let scripts = vec![
|
|
|
|
InsertText("1", 0),
|
|
|
|
StopWs,
|
|
|
|
InsertText("2", 1),
|
|
|
|
InsertText("3", 2),
|
|
|
|
StartWs,
|
|
|
|
WaitSyncFinished,
|
2022-01-01 06:23:58 +00:00
|
|
|
AssertRevisionState(2, RevisionState::Ack),
|
|
|
|
AssertRevisionState(3, RevisionState::Ack),
|
2021-12-26 11:10:37 +00:00
|
|
|
AssertNextRevId(None),
|
|
|
|
AssertJson(r#"[{"insert":"123\n"}]"#),
|
|
|
|
];
|
|
|
|
EditorTest::new().await.run_scripts(scripts).await;
|
|
|
|
}
|