mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: create default grid
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
use crate::script::{invalid_workspace_name_test_case, FolderScript::*, FolderTest};
|
||||
use flowy_collaboration::{client_document::default::initial_quill_delta_string, entities::revision::RevisionState};
|
||||
|
||||
use flowy_folder::entities::workspace::CreateWorkspacePayload;
|
||||
use flowy_sync::disk::RevisionState;
|
||||
use flowy_test::{event_builder::*, FlowySDKTest};
|
||||
|
||||
#[tokio::test]
|
||||
@ -168,16 +169,6 @@ async fn view_update() {
|
||||
assert_eq!(test.view.name, new_name);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn open_document_view() {
|
||||
let mut test = FolderTest::new().await;
|
||||
assert_eq!(test.document_info, None);
|
||||
|
||||
test.run_scripts(vec![OpenDocument]).await;
|
||||
let document_info = test.document_info.unwrap();
|
||||
assert_eq!(document_info.text, initial_quill_delta_string());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[should_panic]
|
||||
async fn view_delete() {
|
||||
|
@ -161,7 +161,8 @@ pub async fn delete_view(sdk: &FlowySDKTest, view_ids: Vec<String>) {
|
||||
.await;
|
||||
}
|
||||
|
||||
pub async fn open_document(sdk: &FlowySDKTest, view_id: &str) -> TextBlockInfo {
|
||||
#[allow(dead_code)]
|
||||
pub async fn set_latest_view(sdk: &FlowySDKTest, view_id: &str) -> TextBlockInfo {
|
||||
let view_id: ViewId = view_id.into();
|
||||
FolderEventBuilder::new(sdk.clone())
|
||||
.event(SetLatestView)
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::helper::*;
|
||||
use flowy_collaboration::entities::{revision::RevisionState, text_block_info::TextBlockInfo};
|
||||
|
||||
use flowy_folder::{errors::ErrorCode, services::folder_editor::ClientFolderEditor};
|
||||
use flowy_folder_data_model::entities::{
|
||||
app::{App, RepeatedApp},
|
||||
@ -7,6 +7,7 @@ use flowy_folder_data_model::entities::{
|
||||
view::{RepeatedView, View, ViewDataType},
|
||||
workspace::Workspace,
|
||||
};
|
||||
use flowy_sync::disk::RevisionState;
|
||||
use flowy_sync::REVISION_WRITE_INTERVAL_IN_MILLIS;
|
||||
use flowy_test::FlowySDKTest;
|
||||
use std::{sync::Arc, time::Duration};
|
||||
@ -42,9 +43,6 @@ pub enum FolderScript {
|
||||
ReadTrash,
|
||||
DeleteAllTrash,
|
||||
|
||||
// Document
|
||||
OpenDocument,
|
||||
|
||||
// Sync
|
||||
AssertCurrentRevId(i64),
|
||||
AssertNextSyncRevId(Option<i64>),
|
||||
@ -58,7 +56,6 @@ pub struct FolderTest {
|
||||
pub app: App,
|
||||
pub view: View,
|
||||
pub trash: Vec<Trash>,
|
||||
pub document_info: Option<TextBlockInfo>,
|
||||
// pub folder_editor:
|
||||
}
|
||||
|
||||
@ -68,7 +65,14 @@ impl FolderTest {
|
||||
let _ = sdk.init_user().await;
|
||||
let mut workspace = create_workspace(&sdk, "FolderWorkspace", "Folder test workspace").await;
|
||||
let mut app = create_app(&sdk, &workspace.id, "Folder App", "Folder test app").await;
|
||||
let view = create_view(&sdk, &app.id, "Folder View", "Folder test view", ViewDataType::Block).await;
|
||||
let view = create_view(
|
||||
&sdk,
|
||||
&app.id,
|
||||
"Folder View",
|
||||
"Folder test view",
|
||||
ViewDataType::TextBlock,
|
||||
)
|
||||
.await;
|
||||
app.belongings = RepeatedView {
|
||||
items: vec![view.clone()],
|
||||
};
|
||||
@ -83,7 +87,6 @@ impl FolderTest {
|
||||
app,
|
||||
view,
|
||||
trash: vec![],
|
||||
document_info: None,
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,7 +149,7 @@ impl FolderTest {
|
||||
}
|
||||
|
||||
FolderScript::CreateView { name, desc } => {
|
||||
let view = create_view(sdk, &self.app.id, &name, &desc, ViewDataType::Block).await;
|
||||
let view = create_view(sdk, &self.app.id, &name, &desc, ViewDataType::TextBlock).await;
|
||||
self.view = view;
|
||||
}
|
||||
FolderScript::AssertView(view) => {
|
||||
@ -179,10 +182,6 @@ impl FolderTest {
|
||||
delete_all_trash(sdk).await;
|
||||
self.trash = vec![];
|
||||
}
|
||||
FolderScript::OpenDocument => {
|
||||
let document_info = open_document(sdk, &self.view.id).await;
|
||||
self.document_info = Some(document_info);
|
||||
}
|
||||
FolderScript::AssertRevisionState { rev_id, state } => {
|
||||
let record = cache.get(rev_id).await.unwrap();
|
||||
assert_eq!(record.state, state);
|
||||
|
Reference in New Issue
Block a user