feat(#248): admin tag page complete overhaul — tree panel, merge, subtree delete, new edit components #249

Merged
marcel merged 51 commits from feat/issue-221-tag-hierarchy into main 2026-04-17 10:24:10 +02:00
Showing only changes of commit c03c391879 - Show all commits

View File

@@ -375,6 +375,46 @@ class TagServiceTest {
assertThat(result).isEqualTo(target);
}
// ─── deleteWithDescendants ────────────────────────────────────────────────
@Test
void deleteWithDescendants_throwsNotFound_whenTagMissing() {
UUID id = UUID.randomUUID();
when(tagRepository.findById(id)).thenReturn(Optional.empty());
assertThatThrownBy(() -> tagService.deleteWithDescendants(id))
.isInstanceOf(DomainException.class)
.extracting(e -> ((DomainException) e).getCode())
.isEqualTo(ErrorCode.TAG_NOT_FOUND);
}
@Test
void deleteWithDescendants_deletesSubtreeDocTagsAndAllTags() {
UUID id = UUID.randomUUID();
UUID childId = UUID.randomUUID();
Tag tag = Tag.builder().id(id).name("Root").build();
when(tagRepository.findById(id)).thenReturn(Optional.of(tag));
when(tagRepository.findDescendantIds(id)).thenReturn(List.of(id, childId));
tagService.deleteWithDescendants(id);
verify(tagRepository).deleteDocumentTagsByTagIds(List.of(id, childId));
verify(tagRepository).deleteAllById(List.of(id, childId));
}
@Test
void deleteWithDescendants_whenLeafTag_deletesTagAndItsOwnDocTags() {
UUID id = UUID.randomUUID();
Tag tag = Tag.builder().id(id).name("Leaf").build();
when(tagRepository.findById(id)).thenReturn(Optional.of(tag));
when(tagRepository.findDescendantIds(id)).thenReturn(List.of(id));
tagService.deleteWithDescendants(id);
verify(tagRepository).deleteDocumentTagsByTagIds(List.of(id));
verify(tagRepository).deleteAllById(List.of(id));
}
// ─── delete ───────────────────────────────────────────────────────────────
@Test