fix: infinite loop when getting ancestor for orphan view (#5375)

This commit is contained in:
Lucas.Xu
2024-05-21 10:47:31 +08:00
committed by GitHub
parent c67e266174
commit 24b3d69860
3 changed files with 50 additions and 0 deletions

View File

@ -1,6 +1,8 @@
use collab_folder::ViewLayout;
use event_integration_test::EventIntegrationTest;
use flowy_folder::entities::icon::{ViewIconPB, ViewIconTypePB};
use flowy_folder::entities::ViewLayoutPB;
use crate::folder::local_test::script::FolderScript::*;
use crate::folder::local_test::script::FolderTest;
@ -331,3 +333,17 @@ async fn move_view_event_test() {
assert_eq!(after_view_ids[0], view_ids[1]);
assert_eq!(after_view_ids[1], view_ids[0]);
}
#[tokio::test]
async fn create_orphan_child_view_and_get_its_ancestors_test() {
let test = EventIntegrationTest::new_anon().await;
let name = "Orphan View";
let view_id = "20240521";
test
.create_orphan_view(name, view_id, ViewLayoutPB::Grid)
.await;
let ancestors = test.get_view_ancestors(view_id).await;
assert_eq!(ancestors.len(), 1);
assert_eq!(ancestors[0].name, "Orphan View");
assert_eq!(ancestors[0].id, view_id);
}