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