test(dashboard): add empty-queue guard and boundary tests for contributor cap
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,38 @@ class TranscriptionQueueServiceTest {
|
||||
assertThat(result.get(0).annotationCount()).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getSegmentationQueue_returnsEmptyList_whenQueueIsEmpty() {
|
||||
when(documentRepository.findSegmentationQueue(5)).thenReturn(List.of());
|
||||
|
||||
List<TranscriptionQueueItemDTO> result = service.getSegmentationQueue();
|
||||
|
||||
assertThat(result).isEmpty();
|
||||
verifyNoInteractions(auditLogQueryService);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getSegmentationQueue_returnsAllFive_andHasMoreFalse_whenExactlyFiveContributors() {
|
||||
UUID docId = UUID.randomUUID();
|
||||
TranscriptionQueueProjection proj = mockQueueProjection(docId, "Brief", null, 0, 0, 0);
|
||||
when(documentRepository.findSegmentationQueue(5)).thenReturn(List.of(proj));
|
||||
|
||||
List<ActivityActorDTO> fiveActors = List.of(
|
||||
new ActivityActorDTO("A1", "#111", "Alice One"),
|
||||
new ActivityActorDTO("A2", "#222", "Alice Two"),
|
||||
new ActivityActorDTO("A3", "#333", "Alice Three"),
|
||||
new ActivityActorDTO("A4", "#444", "Alice Four"),
|
||||
new ActivityActorDTO("A5", "#555", "Alice Five")
|
||||
);
|
||||
when(auditLogQueryService.findContributorsPerDocument(List.of(docId)))
|
||||
.thenReturn(Map.of(docId, fiveActors));
|
||||
|
||||
List<TranscriptionQueueItemDTO> result = service.getSegmentationQueue();
|
||||
|
||||
assertThat(result.get(0).contributors()).hasSize(5);
|
||||
assertThat(result.get(0).hasMoreContributors()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void getSegmentationQueue_mapsDocumentDateWhenPresent() {
|
||||
LocalDate date = LocalDate.of(1920, 6, 15);
|
||||
|
||||
Reference in New Issue
Block a user