2021-07-23 06:37:18 +00:00
|
|
|
use crate::helper::*;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn file_create_test() {
|
2021-07-23 08:45:29 +00:00
|
|
|
let doc_desc = create_doc("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-07-24 06:05:49 +00:00
|
|
|
let doc = read_doc_data(&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() {
|
|
|
|
let doc_desc = create_doc("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-07-23 06:37:18 +00:00
|
|
|
save_doc(&doc_desc, &content);
|
|
|
|
|
2021-07-24 06:05:49 +00:00
|
|
|
let doc = read_doc_data(&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
|
|
|
}
|