AppFlowy/rust-lib/flowy-document/tests/editor/doc_test.rs

26 lines
726 B
Rust
Raw Normal View History

use crate::helper::*;
use flowy_test::FlowyEnv;
#[test]
fn file_create_test() {
let sdk = FlowyEnv::setup().sdk;
2021-09-04 07:12:53 +00:00
let doc_desc = create_doc(&sdk, "hello world", "flutter ❤️ rust", "123");
dbg!(&doc_desc);
2021-09-04 07:12:53 +00:00
let doc = read_doc_data(&sdk, &doc_desc.id, &doc_desc.path);
assert_eq!(doc.text, "123".to_owned());
}
#[test]
fn file_update_text_test() {
let sdk = FlowyEnv::setup().sdk;
2021-09-04 07:12:53 +00:00
let doc_desc = create_doc(&sdk, "hello world", "flutter ❤️ rust", "");
dbg!(&doc_desc);
let content = "😁😁😁😁😁😁😁😁😁😁".to_owned();
2021-09-04 07:12:53 +00:00
save_doc(&sdk, &doc_desc, &content);
2021-09-04 07:12:53 +00:00
let doc = read_doc_data(&sdk, &doc_desc.id, &doc_desc.path);
assert_eq!(doc.text, content);
}