2024-03-29 17:53:59 +09:00
|
|
|
use std::time::Duration;
|
|
|
|
|
2024-04-26 18:00:56 +08:00
|
|
|
use event_integration_test::EventIntegrationTest;
|
2024-03-29 17:53:59 +09:00
|
|
|
use flowy_user::{
|
|
|
|
entities::{RepeatedUserWorkspacePB, UserWorkspacePB},
|
|
|
|
protobuf::UserNotification,
|
|
|
|
};
|
|
|
|
|
|
|
|
use crate::util::receive_with_timeout;
|
|
|
|
|
|
|
|
pub async fn get_synced_workspaces(
|
|
|
|
test: &EventIntegrationTest,
|
|
|
|
user_id: i64,
|
|
|
|
) -> Vec<UserWorkspacePB> {
|
|
|
|
let _workspaces = test.get_all_workspaces().await.items;
|
|
|
|
let sub_id = user_id.to_string();
|
|
|
|
let rx = test
|
|
|
|
.notification_sender
|
|
|
|
.subscribe::<RepeatedUserWorkspacePB>(
|
|
|
|
&sub_id,
|
|
|
|
UserNotification::DidUpdateUserWorkspaces as i32,
|
|
|
|
);
|
2024-04-26 09:44:07 +08:00
|
|
|
receive_with_timeout(rx, Duration::from_secs(60))
|
2024-03-29 17:53:59 +09:00
|
|
|
.await
|
|
|
|
.unwrap()
|
|
|
|
.items
|
|
|
|
}
|