add feature flowy_unit_test

This commit is contained in:
appflowy
2021-12-08 21:51:06 +08:00
parent 7ac55f29db
commit 6b338d4cc5
12 changed files with 217 additions and 105 deletions

View File

@ -3,6 +3,16 @@ use flowy_test::editor::*;
#[tokio::test]
async fn create_doc() {
let test = EditorTest::new().await;
let _editor = test.create_doc().await;
println!("123");
let editor = test.create_doc().await;
let rev_manager = editor.rev_manager();
assert_eq!(rev_manager.rev_id(), 0);
let json = editor.doc_json().await.unwrap();
assert_eq!(json, r#"[{"insert":"\n"}]"#);
editor.insert(0, "123").await.unwrap();
assert_eq!(rev_manager.rev_id(), 1);
editor.insert(0, "456").await.unwrap();
assert_eq!(rev_manager.rev_id(), 2);
}