chore: fix test

This commit is contained in:
Nathan
2025-06-27 14:10:19 +08:00
parent b6cdd88701
commit aa4dbcf73f
4 changed files with 9 additions and 6 deletions

View File

@@ -164,10 +164,11 @@ impl TestClient {
view_id: &str,
view_name: &str,
view_layout: ViewLayout,
uid: i64,
) {
let mut folder = self.get_folder(*workspace_id).await;
let general_space_id = folder
.get_view(&workspace_id.to_string())
.get_view(&workspace_id.to_string(), uid)
.unwrap()
.children
.first()
@@ -181,7 +182,7 @@ impl TestClient {
.view;
{
let mut txn = folder.collab.transact_mut();
folder.body.views.insert(&mut txn, view, None);
folder.body.views.insert(&mut txn, view, None, uid);
}
let folder_collab_type = CollabType::Folder;
self
@@ -215,7 +216,6 @@ impl TestClient {
.unwrap()
.encode_collab;
Folder::from_collab_doc_state(
uid,
CollabOrigin::Client(CollabClient::new(uid, self.device_id.clone())),
folder_collab.into(),
&workspace_id.to_string(),
@@ -322,7 +322,6 @@ impl TestClient {
}
pub async fn get_user_folder(&self) -> Folder {
let uid = self.uid().await;
let workspace_id = self.workspace_id().await;
let data = self
.api_client
@@ -335,7 +334,6 @@ impl TestClient {
.unwrap();
Folder::from_collab_doc_state(
uid,
CollabOrigin::Empty,
data.encode_collab.into(),
&workspace_id.to_string(),

View File

@@ -97,7 +97,6 @@ impl CollabManager {
.await?
.encoded_collab;
trace!("create folder from collab: {}", workspace_id);
let folder = tokio::task::spawn_blocking(move || {
Folder::from_collab_doc_state(
CollabOrigin::Server,

View File

@@ -42,6 +42,7 @@ async fn document_full_sync_then_search_test() {
let object_id = Uuid::new_v4();
let mut local_document = empty_document_editor(&object_id);
let test_client = TestClient::new_user().await;
let uid = test_client.uid().await;
let workspace_id = test_client.workspace_id().await;
let doc_state = local_document.encode_collab().encode_to_bytes().unwrap();
let params = CreateCollabParams {
@@ -57,6 +58,7 @@ async fn document_full_sync_then_search_test() {
&object_id.to_string(),
"AppFlowy",
collab_folder::ViewLayout::Document,
uid,
)
.await;

View File

@@ -24,6 +24,7 @@ async fn test_embedding_when_create_document() {
}
let mut test_client = TestClient::new_user().await;
let uid = test_client.uid().await;
let workspace_id = test_client.workspace_id().await;
// Create the first document and wait for its embedding.
let object_id_1 = add_document_collab(
@@ -32,6 +33,7 @@ async fn test_embedding_when_create_document() {
"the_five_dysfunctions_of_a_team.md",
"five dysfunctional",
true,
uid,
)
.await;
@@ -183,6 +185,7 @@ async fn add_document_collab(
file_name: &str,
search_term: &str,
wait_embedding: bool,
uid: i64,
) -> Uuid {
let object_id = Uuid::new_v4();
let collab = create_document_collab(&object_id.to_string(), file_name).await;
@@ -198,6 +201,7 @@ async fn add_document_collab(
&object_id.to_string(),
search_term,
ViewLayout::Document,
uid,
)
.await;
if wait_embedding {