mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
test: Import folder test (#4321)
* fix: import old version appflowy data * chore: add 037 test * chore: add default appflowy cloud url * chore: bump collab
This commit is contained in:
@ -14,7 +14,11 @@ async fn undo_redo_test() {
|
||||
|
||||
// create a document
|
||||
_ = test
|
||||
.create_document(test.user.user_id().unwrap(), &doc_id, Some(data.clone()))
|
||||
.create_document(
|
||||
test.user_service.user_id().unwrap(),
|
||||
&doc_id,
|
||||
Some(data.clone()),
|
||||
)
|
||||
.await;
|
||||
|
||||
// open a document
|
||||
|
@ -13,7 +13,7 @@ async fn restore_document() {
|
||||
// create a document
|
||||
let doc_id: String = gen_document_id();
|
||||
let data = default_document_data();
|
||||
let uid = test.user.user_id().unwrap();
|
||||
let uid = test.user_service.user_id().unwrap();
|
||||
test
|
||||
.create_document(uid, &doc_id, Some(data.clone()))
|
||||
.await
|
||||
@ -51,7 +51,7 @@ async fn restore_document() {
|
||||
#[tokio::test]
|
||||
async fn document_apply_insert_action() {
|
||||
let test = DocumentTest::new();
|
||||
let uid = test.user.user_id().unwrap();
|
||||
let uid = test.user_service.user_id().unwrap();
|
||||
let doc_id: String = gen_document_id();
|
||||
let data = default_document_data();
|
||||
|
||||
@ -105,7 +105,7 @@ async fn document_apply_insert_action() {
|
||||
async fn document_apply_update_page_action() {
|
||||
let test = DocumentTest::new();
|
||||
let doc_id: String = gen_document_id();
|
||||
let uid = test.user.user_id().unwrap();
|
||||
let uid = test.user_service.user_id().unwrap();
|
||||
let data = default_document_data();
|
||||
|
||||
// create a document
|
||||
@ -147,7 +147,7 @@ async fn document_apply_update_page_action() {
|
||||
#[tokio::test]
|
||||
async fn document_apply_update_action() {
|
||||
let test = DocumentTest::new();
|
||||
let uid = test.user.user_id().unwrap();
|
||||
let uid = test.user_service.user_id().unwrap();
|
||||
let doc_id: String = gen_document_id();
|
||||
let data = default_document_data();
|
||||
|
||||
|
@ -19,9 +19,10 @@ use collab_integrate::collab_builder::{
|
||||
};
|
||||
use collab_integrate::CollabKVDB;
|
||||
use flowy_document::document::MutexDocument;
|
||||
use flowy_document::manager::{DocumentManager, DocumentUser};
|
||||
use flowy_document::entities::{DocumentSnapshotData, DocumentSnapshotMeta};
|
||||
use flowy_document::manager::{DocumentManager, DocumentSnapshotService, DocumentUserService};
|
||||
use flowy_document_deps::cloud::*;
|
||||
use flowy_error::{ErrorCode, FlowyError};
|
||||
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
|
||||
use flowy_storage::{FileStorageService, StorageObject};
|
||||
use lib_infra::async_trait::async_trait;
|
||||
use lib_infra::future::{to_fut, Fut, FutureResult};
|
||||
@ -35,11 +36,13 @@ impl DocumentTest {
|
||||
let user = FakeUser::new();
|
||||
let cloud_service = Arc::new(LocalTestDocumentCloudServiceImpl());
|
||||
let file_storage = Arc::new(DocumentTestFileStorageService) as Arc<dyn FileStorageService>;
|
||||
let document_snapshot = Arc::new(DocumentTestSnapshot);
|
||||
let manager = DocumentManager::new(
|
||||
Arc::new(user),
|
||||
default_collab_builder(),
|
||||
cloud_service,
|
||||
Arc::downgrade(&file_storage),
|
||||
document_snapshot,
|
||||
);
|
||||
Self { inner: manager }
|
||||
}
|
||||
@ -69,7 +72,7 @@ impl FakeUser {
|
||||
}
|
||||
}
|
||||
|
||||
impl DocumentUser for FakeUser {
|
||||
impl DocumentUserService for FakeUser {
|
||||
fn user_id(&self) -> Result<i64, FlowyError> {
|
||||
Ok(1)
|
||||
}
|
||||
@ -110,7 +113,7 @@ pub async fn create_and_open_empty_document() -> (DocumentTest, Arc<MutexDocumen
|
||||
let test = DocumentTest::new();
|
||||
let doc_id: String = gen_document_id();
|
||||
let data = default_document_data();
|
||||
let uid = test.user.user_id().unwrap();
|
||||
let uid = test.user_service.user_id().unwrap();
|
||||
// create a document
|
||||
test
|
||||
.create_document(uid, &doc_id, Some(data.clone()))
|
||||
@ -196,3 +199,17 @@ impl CollabCloudPluginProvider for DefaultCollabStorageProvider {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
struct DocumentTestSnapshot;
|
||||
impl DocumentSnapshotService for DocumentTestSnapshot {
|
||||
fn get_document_snapshot_metas(
|
||||
&self,
|
||||
_document_id: &str,
|
||||
) -> FlowyResult<Vec<DocumentSnapshotMeta>> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn get_document_snapshot(&self, _snapshot_id: &str) -> FlowyResult<DocumentSnapshotData> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user