mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
test: add app bloc test (#1370)
This commit is contained in:
@ -92,7 +92,7 @@ impl WorkspaceIdPB {
|
||||
}
|
||||
|
||||
#[derive(Default, ProtoBuf, Clone)]
|
||||
pub struct CurrentWorkspaceSettingPB {
|
||||
pub struct WorkspaceSettingPB {
|
||||
#[pb(index = 1)]
|
||||
pub workspace: WorkspacePB,
|
||||
|
||||
|
@ -46,7 +46,7 @@ pub fn create(folder: Arc<FolderManager>) -> Module {
|
||||
// Workspace
|
||||
module = module
|
||||
.event(FolderEvent::CreateWorkspace, create_workspace_handler)
|
||||
.event(FolderEvent::ReadCurWorkspace, read_cur_workspace_handler)
|
||||
.event(FolderEvent::ReadCurrentWorkspace, read_cur_workspace_handler)
|
||||
.event(FolderEvent::ReadWorkspaces, read_workspaces_handler)
|
||||
.event(FolderEvent::OpenWorkspace, open_workspace_handler)
|
||||
.event(FolderEvent::ReadWorkspaceApps, read_workspace_apps_handler);
|
||||
@ -87,8 +87,8 @@ pub enum FolderEvent {
|
||||
#[event(input = "CreateWorkspacePayloadPB", output = "WorkspacePB")]
|
||||
CreateWorkspace = 0,
|
||||
|
||||
#[event(output = "CurrentWorkspaceSettingPB")]
|
||||
ReadCurWorkspace = 1,
|
||||
#[event(output = "WorkspaceSettingPB")]
|
||||
ReadCurrentWorkspace = 1,
|
||||
|
||||
#[event(input = "WorkspaceIdPB", output = "RepeatedWorkspacePB")]
|
||||
ReadWorkspaces = 2,
|
||||
|
@ -221,11 +221,11 @@ pub async fn notify_workspace_setting_did_change(
|
||||
)?;
|
||||
|
||||
let setting = match transaction.read_view(view_id) {
|
||||
Ok(latest_view) => CurrentWorkspaceSettingPB {
|
||||
Ok(latest_view) => WorkspaceSettingPB {
|
||||
workspace,
|
||||
latest_view: Some(latest_view.into()),
|
||||
},
|
||||
Err(_) => CurrentWorkspaceSettingPB {
|
||||
Err(_) => WorkspaceSettingPB {
|
||||
workspace,
|
||||
latest_view: None,
|
||||
},
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::entities::{
|
||||
app::RepeatedAppPB,
|
||||
view::ViewPB,
|
||||
workspace::{CurrentWorkspaceSettingPB, RepeatedWorkspacePB, WorkspaceIdPB, *},
|
||||
workspace::{RepeatedWorkspacePB, WorkspaceIdPB, WorkspaceSettingPB, *},
|
||||
};
|
||||
use crate::{
|
||||
dart_notification::{send_dart_notification, FolderNotification},
|
||||
@ -79,7 +79,7 @@ pub(crate) async fn read_workspaces_handler(
|
||||
#[tracing::instrument(level = "debug", skip(folder), err)]
|
||||
pub async fn read_cur_workspace_handler(
|
||||
folder: AppData<Arc<FolderManager>>,
|
||||
) -> DataResult<CurrentWorkspaceSettingPB, FlowyError> {
|
||||
) -> DataResult<WorkspaceSettingPB, FlowyError> {
|
||||
let workspace_id = get_current_workspace()?;
|
||||
let user_id = folder.user.user_id()?;
|
||||
let params = WorkspaceIdPB {
|
||||
@ -101,7 +101,7 @@ pub async fn read_cur_workspace_handler(
|
||||
.await
|
||||
.unwrap_or(None)
|
||||
.map(|view_rev| view_rev.into());
|
||||
let setting = CurrentWorkspaceSettingPB { workspace, latest_view };
|
||||
let setting = WorkspaceSettingPB { workspace, latest_view };
|
||||
let _ = read_workspaces_on_server(folder, user_id, params);
|
||||
data_result(setting)
|
||||
}
|
||||
|
Reference in New Issue
Block a user