AppFlowy/backend/tests/api/doc.rs

31 lines
781 B
Rust
Raw Normal View History

2021-09-11 06:26:30 +00:00
use crate::helper::ViewTest;
use flowy_document::entities::doc::DocIdentifier;
2021-11-08 02:57:33 +00:00
use flowy_workspace_infra::entities::view::ViewIdentifiers;
2021-09-10 10:21:35 +00:00
#[actix_rt::test]
2021-09-11 06:26:30 +00:00
async fn doc_read() {
let test = ViewTest::new().await;
2021-09-10 10:21:35 +00:00
let params = DocIdentifier {
2021-09-11 06:26:30 +00:00
doc_id: test.view.id.clone(),
};
let doc = test.server.read_doc(params).await;
assert_eq!(doc.is_some(), true);
}
#[actix_rt::test]
async fn doc_delete() {
let test = ViewTest::new().await;
let delete_params = ViewIdentifiers {
2021-10-15 05:42:52 +00:00
view_ids: vec![test.view.id.clone()],
2021-09-11 06:26:30 +00:00
};
test.server.delete_view(delete_params).await;
let params = DocIdentifier {
2021-09-11 06:26:30 +00:00
doc_id: test.view.id.clone(),
};
let doc = test.server.read_doc(params).await;
assert_eq!(doc.is_none(), true);
2021-09-10 10:21:35 +00:00
}