mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-25 07:07:32 -04:00
chore: update client api (#5208)
* chore: update client api * chore: rename test target * chore: fix test
This commit is contained in:
parent
d86afb03ba
commit
122a392bf8
95 changed files with 160 additions and 160 deletions
|
@ -0,0 +1,49 @@
|
|||
use std::ops::Deref;
|
||||
|
||||
use event_integration_test::event_builder::EventBuilder;
|
||||
use flowy_document::entities::{OpenDocumentPayloadPB, RepeatedDocumentSnapshotMetaPB};
|
||||
use flowy_document::event_map::DocumentEvent::GetDocumentSnapshotMeta;
|
||||
use flowy_folder::entities::ViewPB;
|
||||
|
||||
use crate::util::FlowySupabaseTest;
|
||||
|
||||
pub struct FlowySupabaseDocumentTest {
|
||||
inner: FlowySupabaseTest,
|
||||
}
|
||||
|
||||
impl FlowySupabaseDocumentTest {
|
||||
pub async fn new() -> Option<Self> {
|
||||
let inner = FlowySupabaseTest::new().await?;
|
||||
let uuid = uuid::Uuid::new_v4().to_string();
|
||||
let _ = inner.supabase_sign_up_with_uuid(&uuid, None).await;
|
||||
Some(Self { inner })
|
||||
}
|
||||
|
||||
pub async fn create_document(&self) -> ViewPB {
|
||||
let current_workspace = self.inner.get_current_workspace().await;
|
||||
self
|
||||
.inner
|
||||
.create_and_open_document(¤t_workspace.id, "my document".to_string(), vec![])
|
||||
.await
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub async fn get_document_snapshots(&self, view_id: &str) -> RepeatedDocumentSnapshotMetaPB {
|
||||
EventBuilder::new(self.inner.deref().clone())
|
||||
.event(GetDocumentSnapshotMeta)
|
||||
.payload(OpenDocumentPayloadPB {
|
||||
document_id: view_id.to_string(),
|
||||
})
|
||||
.async_send()
|
||||
.await
|
||||
.parse::<RepeatedDocumentSnapshotMetaPB>()
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for FlowySupabaseDocumentTest {
|
||||
type Target = FlowySupabaseTest;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.inner
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue