mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-25 15:17:28 -04:00
* refactor: remove singleton db * chore: fix warning * chore: fix warning * chore: update test * chore: only resotre or backup when init call * test: fix * test: fix * test: fix * fix: timeout notification * chore: rename * chore: rename * chore: disable test * chore: remove log * chore: remove log * chore: add log * chore: rename test functions * chore: add test asset * chore: bump client api * chore: disable some tests
49 lines
1.4 KiB
Rust
49 lines
1.4 KiB
Rust
use std::ops::Deref;
|
|
|
|
use event_integration::event_builder::EventBuilder;
|
|
use flowy_document2::entities::{OpenDocumentPayloadPB, RepeatedDocumentSnapshotPB};
|
|
use flowy_document2::event_map::DocumentEvent::GetDocumentSnapshots;
|
|
use flowy_folder2::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) -> RepeatedDocumentSnapshotPB {
|
|
EventBuilder::new(self.inner.deref().clone())
|
|
.event(GetDocumentSnapshots)
|
|
.payload(OpenDocumentPayloadPB {
|
|
document_id: view_id.to_string(),
|
|
})
|
|
.async_send()
|
|
.await
|
|
.parse::<RepeatedDocumentSnapshotPB>()
|
|
}
|
|
}
|
|
|
|
impl Deref for FlowySupabaseDocumentTest {
|
|
type Target = FlowySupabaseTest;
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
&self.inner
|
|
}
|
|
}
|