@@ -4,7 +4,9 @@ use collab_entity::CollabType;
44use event_integration:: user_event:: user_localhost_af_cloud;
55use event_integration:: { document_data_from_document_doc_state, EventIntegrationTest } ;
66use flowy_core:: DEFAULT_NAME ;
7+ use flowy_user:: errors:: ErrorCode ;
78use serde_json:: { json, Value } ;
9+ use std:: env:: temp_dir;
810
911#[ tokio:: test]
1012async fn import_appflowy_data_folder_test ( ) {
@@ -29,7 +31,8 @@ async fn import_appflowy_data_folder_test() {
2931 user_db_path. to_str ( ) . unwrap ( ) . to_string ( ) ,
3032 & import_container_name,
3133 )
32- . await ;
34+ . await
35+ . unwrap ( ) ;
3336 // after import, the structure is:
3437 // workspace:
3538 // view: Getting Started
@@ -74,7 +77,8 @@ async fn import_appflowy_data_folder_test2() {
7477 user_db_path. to_str ( ) . unwrap ( ) . to_string ( ) ,
7578 & import_container_name,
7679 )
77- . await ;
80+ . await
81+ . unwrap ( ) ;
7882
7983 let views = test. get_all_workspace_views ( ) . await ;
8084 assert_eq ! ( views. len( ) , 2 ) ;
@@ -84,6 +88,19 @@ async fn import_appflowy_data_folder_test2() {
8488 drop ( cleaner) ;
8589}
8690
91+ #[ tokio:: test]
92+ async fn import_empty_appflowy_data_folder_test ( ) {
93+ let path = temp_dir ( ) ;
94+ user_localhost_af_cloud ( ) . await ;
95+ let test = EventIntegrationTest :: new_with_name ( DEFAULT_NAME ) . await ;
96+ let _ = test. af_cloud_sign_up ( ) . await ;
97+ let error = test
98+ . import_appflowy_data ( path. to_str ( ) . unwrap ( ) . to_string ( ) , "empty_folder" )
99+ . await
100+ . unwrap_err ( ) ;
101+ assert_eq ! ( error. code, ErrorCode :: AppFlowyDataFolderImportError ) ;
102+ }
103+
87104#[ tokio:: test]
88105async fn import_appflowy_data_folder_multiple_times_test ( ) {
89106 let import_container_name = "040_local_2" . to_string ( ) ;
@@ -106,7 +123,8 @@ async fn import_appflowy_data_folder_multiple_times_test() {
106123 user_db_path. to_str ( ) . unwrap ( ) . to_string ( ) ,
107124 & import_container_name,
108125 )
109- . await ;
126+ . await
127+ . unwrap ( ) ;
110128 // after import, the structure is:
111129 // Getting Started
112130 // 040_local_2
@@ -121,7 +139,8 @@ async fn import_appflowy_data_folder_multiple_times_test() {
121139 user_db_path. to_str ( ) . unwrap ( ) . to_string ( ) ,
122140 & import_container_name,
123141 )
124- . await ;
142+ . await
143+ . unwrap ( ) ;
125144 // after import, the structure is:
126145 // Getting Started
127146 // 040_local_2
0 commit comments