Nathan.fooo cc66147bc0
chore: checking workspace state consistent after switching workspace (#5201)
* refactor: getting workspace id

* refactor: check workspace id is match for http response

* refactor: check http repsonse in valid by checing the workspace id

* chore: update log

* chore: fix test

* chore: fix test

* chore: add test

* chore: update test
2024-04-26 09:44:07 +08:00

28 lines
677 B
Rust

use std::time::Duration;
use event_integration::EventIntegrationTest;
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,
);
receive_with_timeout(rx, Duration::from_secs(60))
.await
.unwrap()
.items
}