Browse Source

[rust]:putback the app from trash

appflowy 3 years ago
parent
commit
3387301554
1 changed files with 25 additions and 1 deletions
  1. 25 1
      rust-lib/flowy-workspace/tests/workspace/app_test.rs

+ 25 - 1
rust-lib/flowy-workspace/tests/workspace/app_test.rs

@@ -1,5 +1,9 @@
 use flowy_test::workspace::*;
-use flowy_workspace::entities::{app::QueryAppRequest, view::*};
+use flowy_workspace::entities::{
+    app::QueryAppRequest,
+    trash::{TrashIdentifier, TrashType},
+    view::*,
+};
 
 #[tokio::test]
 #[should_panic]
@@ -12,6 +16,26 @@ async fn app_delete() {
     let _ = read_app(&test.sdk, query).await;
 }
 
+#[tokio::test]
+async fn app_delete_then_putback() {
+    let test = AppTest::new().await;
+    delete_app(&test.sdk, &test.app.id).await;
+    putback_trash(
+        &test.sdk,
+        TrashIdentifier {
+            id: test.app.id.clone(),
+            ty: TrashType::App,
+        },
+    )
+    .await;
+
+    let query = QueryAppRequest {
+        app_ids: vec![test.app.id.clone()],
+    };
+    let app = read_app(&test.sdk, query).await;
+    assert_eq!(&app, &test.app);
+}
+
 #[tokio::test]
 async fn app_read() {
     let test = AppTest::new().await;